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
--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
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
Here is my database queue config in
'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
I expect the job to take not more than 5 seconds, and so setting
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.
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?
from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3mRkKw2