Reputation: 731
I am troubling with php artisan queue::work command.
My command not working but my jobs are inserted into job table but never executing.
I am using mongodb driver for queue.
What I am doing wrong please suggest me.
Upvotes: 3
Views: 10203
Reputation: 831
After spending half day on searching I noticed that queues do not run on maintenance mode. You have to put --force
at the end of it.
--force Force the worker to run even in maintenance mode
So run php artisan queue:work --force
in order to run queues on maintenance mode.
See https://laravel.com/docs/8.x/configuration#maintenance-mode for details.
Upvotes: 10
Reputation: 189
I was having the similar issue. The Jobs were being inserted into jobs table in MySql DB, but php artisan queue:work
didn't pick those up.
In my case the queue was named (queue column value in jobs table) 'priority'.
So i had to run the queue:work command differently:
php artisan queue:work --daemon --queue=priority
But careful that above command only executes jobs in priority
queue; You can add more queue names if needed like so --queue=priority,queue_3,queue_4
I was expecting queue:work
without --queue=
value to pickup any pending jobs.
Turns out, I was wrong. ¯\_(ツ)_/¯
Hope this helps somebody else.
Upvotes: 2
Reputation: 1
Since this thread is a little bit old, I'll share my experience of it.
There is an error which is not obvious to find but corresponding to this condition. You can check your table jobs
, and in Laravel the jobs should have literally been removed if your queue:work
works well, so the problem is that your queue cannot deal with the top job in your table. It may be a problem of serializable data in db.
To solve it, you can try clearing the table jobs
and reset the 'incremental id
' from ~0
. On the other hand, you can also check your data sequence. This may be helpful after resetting the table.
Upvotes: 0