Why won't you up the timeout ?
php artisan queue:listen --timeout=300
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How is the best way to handle long running jobs?
We are using supervisor to run "queue:work" with "--daemon", and the way that jobs are reserved for ttr of 60 seconds when a thread gets a job from the queue can allow other threads to get the same job where the process takes longer than 60 seconds.
I know that having a job that takes longer than 60 seconds needs to be reviewed to see if it really needs to take that long, but a good use case is generating a very complicated PDF report that the user request to have generated, so the request gets queued up. The job gets picked up by one of the worker threads, and starts crunching all of the data. If the process takes > than the ttr, then a second process (assuming that you are running more than 1 queue worker thread) will be given that same job, and it will start that same process. This could/would essentially monopolize all of the threads & never get "done"
I know that I can try to break the job into smaller chunks to do a little work & then requeue the next piece or increase the ttr, but both of those feel like bandaids.
Is there a way to have the job update/tell the queue that it is still working away, so reup the reservation?
@LucasFecko I appreciate your suggestion.
In cause you are curious, redis appears to do the same thing, but calls it "expire" instead of "ttr"...
https://github.com/laravel/framework/blob/master/src/Illuminate/Queue/RedisQueue.php#L139
We are not restarting the queue because things are going wrong. We do continuous deployment of code using Jenkins to push the code the servers once all of the tests pass. After the code is deployed to a date time folder, then we update the symbolic link to do zero downtime deployments. This is very simular to the way that Taylor does it with Envoyer...
https://laracasts.com/series/envoyer/episodes/2
so by using queue:listen then redis is getting a pointer to some files, which are broken after the symbolic link is updated to the new location. This will cause your jobs to stop working. Also, this will not allow redis to pick up any changes that may've been made as the artisan script is now in memory. There is no safe way to restart the queue when it was ran as queue:listen, but by using queue:work with daemon, then you can safe shut it down.
Here is another thread about this issue...
https://laracasts.com/discuss/channels/general-discussion/supervisor-and-artisan-queues
Anyhow, I am hoping that someone has some way to renew the reservation on a long running job?
Please or to participate in this conversation.