I have a job that queries an external api but wether upon the result of the api the job should be retried later. The thing is that I tried doing $this->release(60); in the handle function of the job to retry it in 60 seconds but the job will always fail with the exception MaximumRetriesExceeded. Why is this?
This is the code I wrote which works, I was wondering why this works and the use of release(60) does not.
/**
* Execute the job.
*/
public function handle()
{
$client = app()->make(Client::class);
// Check if the asyonchronous reboot job has finished
$response = $client->queryAsyncJob($this->jobid, RebootVirtualMachineCommandResponse::class);
if (false === $response) {
$this->delete();
dispatch(new self($this->jobid, $this->vps->id))->delay(60);
return;
// Instead of the above lines this is where I had the release(60) call (without the delete)
}
$this->vps->performing_action = VpsActionType::NONE;
$this->vps->save();
}