In order to process large numbers of jobs, I run a variable number of queue workers depending on howmuch work there is to complete. I don\'t want to run more workers than ar
We've implemented something like this in our application - but it was not something that was built-in to Laravel itself. You would have to edit this file, by adding another condition to the if-block so that it would call the stop
function. You can do this by either setting a static variable in the Worker
class that gets changed whenever you run a custom command that you'll have to make (i.e. php artisan queue:pause
) or by checking an atomic value somewhere (i.e. set it in some cache like redis, memcached, APC or even MySQL, though this would mean you'll have one MySQL query for every cycle of this while-loop) that you set using the same custom command.