8
votes

developers, I have a problem. My queue not working or i just not understand how it's works. I create a command which should add a new queue job. Driver for Queue is - database. After executing my command i see a new row in table 'jobs'. After that I try to do "php artisan queue:work" - but nothing happens.

Help me please, how can I execute this job?

3
Have you checked your logs for any possible errors?Hkan
I also tried to execute queue:listen - no results.lieroes

3 Answers

7
votes

From the documentation : [Daemon Queue Listener] The queue:work artisan command includes a --daemon option for forcing the queue worker to continue processing jobs without ever re-booting the framework. This results in a significant reduction of CPU usage when compared to the queue:listen command:

To start a queue worker in daemon mode, use the --daemon flag:

php artisan queue:work connection --daemon

However if you don't have multiple connections remove connection and execute it without connection :

php artisan queue:work --daemon

It worked for me.

1
votes

Yes there are times when your queue jobs won't run. For deployment if you are using redis queue driver, if not you can follow this here to install and configure redis and after which you should create a table for failed jobs using php artisan queue:failed-table php artisan migrate and then use php artisan queue:work redis --tries=3 --backoff=3 to retry every failed jobs 3 times after 3 seconds of failure.

0
votes

Try

php artisan queue:listen

instead.