Laravel Queues – why is Queue job retrying every 3 seconds, if I specify timeout=5 and expire=>7?

I am trying to set up my queue worker in Laravel 5.3 and am trying to ensure that I fully understand nuances of the interrelated parameters expire, --tries, --timeout, because the results I am seeing suggest I am not understanding something.

Note: In the Laravel 5.3 documentation (https://laravel.com/docs/5.3/queues#introduction), it refers to retry_after as being a parameter for the database queue connection type, but in my installation of Laravel 5.3, that parameter seems to be expire.

In any case, I have a job, let’s call it SendReminder. I purposefully added a line of code that causes an error, so I can test the functioning of the queue tries/retries and eventual labeling of the job as failed in the failed_jobs table.

Here is my database queue config in queue.php:

        'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 7,
'expire' => 7,
],

For testing, I want to let it try 3 times before being sent to failed_jobs table.

I expect the job to take not more than 5 seconds, and so setting --timeout=5, and expire to 7 (or retry_after to 7), would seem to be in line with the Queue documentation, which says “The –timeout value should always be at least several seconds shorter than your retry_after configuration value. This will ensure that a worker processing a given job is always killed before the job is retried.”

Based on above, I expect the job to be considered failed after 21 seconds.

After running php artisan queue:work --daemon --queue=email,default --timeout=5 --tries=3 and then dispatching the job via php artisan schedule:run >> /dev/null 2>&1

I count with my stopwatch 9 seconds until the queue worker displays

[2022-09-02 14:22:14] Failed: AppJobsPrepareSendReminderJob

and in my Laravel log I see

[2022-09-02 14:22:08] local.ERROR: ErrorException:
[2022-09-02 14:22:11] local.ERROR: ErrorException:
[2022-09-02 14:22:14] local.ERROR: ErrorException:

This doesn’t seem to make sense. I would expect, based on my expire being set to 7, that the failure message would only come 21 seconds after the job is dispatched and immediately picked up by the queue. And I get same result every time – 3 seconds between each error message in the log.

Can someone explain why I am seeing this result?

Thanks!

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3mRkKw2
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.