简体   繁体   中英

Laravel queue doesn't fail automatically despite using --tries

I'm want to queue some jobs using Redis,so I made an Event and its Listener.

The Listener implements ShouldQueue. I deliberately throw exception to test whether it fails. By entering the the command php artisan queue:work --tries=3 it should try the job 3 times and if it can't be done, add it to failed-jobs right? but it doesn't do so. I tried using database driver but nothing changed.

One time I used php artisan queue:work --tries=3 --daemon despite the fact that --daemon is deprecated, and after 3 tries,the job was marked as failed - but when I stopped the command and ran it again, it didn't fail again.

why is this happening? Thanks in advance :)

I think you should deal with the failed jobs and check for the reasons , I suggest Adding Failed_jobs Table and check for failure reasons run theses commands to use that

php artisan queue:failed-table

php artisan migrate

Then try

php artisan queue:work redis --tries=3 --delay=3

If the job failed check the failed jobs table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM