Fixes for mailers

This commit is contained in:
David Bomba 2023-08-19 16:44:17 +10:00
parent 87d14dd052
commit 85b5398718

View File

@ -51,7 +51,7 @@ class NinjaMailerJob implements ShouldQueue
public $override;
/** @var \App\Models\Company $company | null **/
/** @var null|\App\Models\Company $company **/
public ?Company $company;
private $mailer;
@ -143,8 +143,6 @@ class NinjaMailerJob implements ShouldQueue
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
->send();
$this->nmo = null;
$this->company = null;
} catch(\Symfony\Component\Mime\Exception\RfcComplianceException $e) {
nlog("Mailer failed with a Logic Exception {$e->getMessage()}");
$this->fail();
@ -195,6 +193,9 @@ class NinjaMailerJob implements ShouldQueue
$this->release($this->backoff()[$this->attempts()-1]);
}
$this->nmo = null;
$this->company = null;
/*Clean up mailers*/
$this->cleanUpMailers();
}