Bilal Baraz
Bilal Baraz

Reputation: 135

How to retry job until fail in laravel?

I have a number of jobs on my queue table. I want to run a job until fail. After that job, the queue polls next job.

Currently Laravel Queue pulls all jobs to run row by row. But I don't want to pull next job unless first job is succeed.

Upvotes: 1

Views: 1262

Answers (1)

Sangar82
Sangar82

Reputation: 5230

If you can detect if your first job is done or not, you can use:

$this->release(10);

inside the job to release the job 10 seconds if the first is not finished.

This way allows you to process a job if you want or not and return to the queue if it's necessary.

Upvotes: 1

Related Questions