How to run queue:work command in laravel task scheduler?

I have been searching a lot for a solution until I just gave up…
I want to run php artisan queue:work --stop-when-empty command every minute in Laravel task scheduler.

I have tried this

$schedule->command('queue:work --stop-when-empty')->everyMinute()->runInBackground();

but that doesn’t seem to work at all…

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You are not supposed to run the queue in the scheduler.

The queue should always be up and running (using a process manager, like Supervisor) and pick jobs when they are dispatched (dispatched in a scheduled task or somewhere else, it doesn’t matter).

Here is the documentation on this topic: https://laravel.com/docs/8.x/queues#supervisor-configuration


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x