Closed milsanore closed 6 years ago
It is not correct, /vendor/laravel/framework/src/Illuminate/Queue/Worker.php
protected function timeoutForJob($job, WorkerOptions $options)
{
return $job && ! is_null($job->timeout()) ? $job->timeout() : $options->timeout;
}
It means if value is null it will use timeout from queue worker option ie
php artisan queue:work --timeout=3600
This was fixed in the following pull-request. Closing.
My env:
Hi, as always thank you for the brilliant project, it's the backbone of my system.
I have a long-running job (an hour), so I explicitly define the
$timeout = 3600;
member variable in my job class.If a job is SIGKILL'ed, the connection to rabbitmq will be severed, and rabbitmq will re-enqueue the message correctly.
However, if I throw an Exception inside my job's
handle()
function, the message that is re-enqueued has itstimeout
variable set tonull
.I.e. the re-enqueued message looks like the following:
after SIGKILL:
after Exception:
The problem for me is this: my hour-long job sometimes experiences a network exception. After this the job is re-enqueued with no timeout value. Note that the default timeout value in Laravel is one minute. So after my job restarts, it times out after one minute. Repeatedly. But note, that when a job experiences a timeout, an exception is not throw, rather the process is SIGKILL'ed, and this does not increment the failed count (I have raised a bug for this https://github.com/laravel/framework/issues/22694), therefore my job loops forever.
Steps To Reproduce:
handle()
functiontimeout: 3600
fieldtimeout: null
fieldThanks,