If you want to restart the failed process again at the same moment. you can do something like that.
Here the object is in memory when the task is restarted so that the data is available.
I did not test it by running it, but I hope it will work
class MailJob extends Job{
public $tries = 3;
public $status;
public function __construct()
{
$this->status = false;
}
public function handle()
{
$this->status = true;
$failed = processFailedisConfirm();
if $failed == true && $this->tries > -1 {
$this->tries = $this->tries - 1;
$this->handel();
}
}}
An example processFailedisConfirm could be
public function processFailedisConfirm(){
$state = (Do Some Api Call);
if ( $state == "200" ){
return false;
} else {
return true;
}
. api, 200, .
.
, api desigend api.