Reputation: 2970
I have a setup where sometimes a job will timeout. The problem is that it keeps hogging the queue and the other jobs won't run.
I want to delete the jobs which timeout 3 times and continue on with the queue. How can I do this? This is specific to laravel 4.2
Upvotes: 1
Views: 926
Reputation: 219930
The $job
object has an attempts
method that tells you how many times it tried to run:
public function fire($job, $data)
{
// Try to process. If failed:
if ($job->attempts() >= 3)
{
$job->delete();
}
}
Upvotes: 2