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

Time:09-16

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...

CodePudding user response:

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

  • Related