2

I am using Laravel 5.7 with php 7.3, Apache2, Redis for Laravel Horizon.

I am getting an issue, the jobs never get fail if there is any error. Ex. If I forget to add the use App\Order; then ideally this shall be marked as Failed but currently it does now which creates a lot of confusion that the jobs are getting executed. I am getting this issue since the very beginning.

In addition to this, the job is not marked as complete even if there is any other error like calculation error (divide by 0) and missing key for array etc.

Prashant Pokhriyal
  • 3,727
  • 4
  • 28
  • 40

1 Answers1

0

When running your queue worker, you should specify the maximum number of times a job should be attempted using the --tries switch on the queue:work command. If you do not specify a value for the --tries option, jobs will be attempted indefinitely.

php artisan queue:work redis --tries=3

After a job has exceeded the specified amount of attempts, it will be inserted into the failed_jobs database table.

Doc.

Prashant Pokhriyal
  • 3,727
  • 4
  • 28
  • 40