Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Laravel Support Timeout Option for Queue Workers?

I know Laravel has a --timeout option for their php artisan queue:listen command, however I would like to use queue:work instead to save some CPU usage. As far as I can tell, there isn't a way to set the timeout option with the queue worker. Will it time out if my job takes more than the 60 second default, or does the timeout just apply to queue:listen?

I just want to make sure my jobs have enough time to run since I'm doing things like running reports in the background, and some take more than 60 seconds to generate due to the size of the dataset. It seems like they're running ok, I just want some clarification as to how that works so that I can make sure I won't run into issues.

like image 952
DuckPuncher Avatar asked Dec 11 '15 15:12

DuckPuncher


People also ask

What is queue worker in Laravel?

Laravel Queue WorkersWhen we run the artisan command queue:work , we activate workers. When we changed from one job to several smaller jobs, we created ten independent workers, which means that these ten jobs will be executed like there are ten different invisible users in the background.

What is the difference between job and queue in Laravel?

Jobs and QueuesThe line itself is the Queue, and each customer in the line is a Job. In order to process Jobs in the Queue you need command line processes or daemons. Think of launching a queue daemon on the command line as adding a new bank teller to the pool of available bank tellers.

Are Laravel jobs asynchronous?

Laravel Jobs are not asynchronous.

How do I know if Laravel queue is running?

This is lower level but in the same vein you could run a command such as ps -aux | grep queue to literally view the running queue processes on whatever server your application/queue workers are running on.


1 Answers

the --timeout is an artificial timeout in Symphony's Process class.

If you're using supervisord, it shouldn't time out, but you might want to look at your PHP max_execution_time.

like image 104
Scott C Avatar answered Oct 05 '22 04:10

Scott C