bump nobody already got the same problem? I think it's not that exotic to check the callbacks of API requests and disable them when failing many times.
Dec 30, 2016
3
Level 13
laravel queue (retry jobs 5 times, after 5 minutes if it failed) & mark job as failed
Dear community,
I've got a queue running some callback requests to endpoint of my users.
Here's the code of my queue.
public function handle()
{
//send webrequest here....
//check the response of user backend
if ($res->getStatusCode() != 200 || $res->getBody()->getContents() != "*received*")
throw new Exception('callback url not reachable');
}
public function failed(Exception $exception)
{
//check tries and try again if needed
//check if job failed for 5 times
//if not ->retry again in 5 minutes, increment the times tried
//if yes ->disable API access, send email
Log::info("user email send, callback disabled!");
}
How to let the job fail (my current exception makes the whole job end), when webrequest answer is != "received" and check if the certain job failed 5 times? If a job failed it should be tried again in 5 minutes.
I don't understand the doc regarding these points.
Please or to participate in this conversation.