mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Emailer to use the appropriate backoff()
This commit is contained in:
parent
a896faf0bf
commit
94a84dfb15
@ -64,6 +64,7 @@ class EmailMailer implements ShouldQueue
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
MultiDB::setDb($this->email_service->company->db);
|
MultiDB::setDb($this->email_service->company->db);
|
||||||
|
|
||||||
/* Perform final checks */
|
/* Perform final checks */
|
||||||
@ -97,10 +98,8 @@ class EmailMailer implements ShouldQueue
|
|||||||
|
|
||||||
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
|
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
|
||||||
|
|
||||||
nlog("error failed with {$e->getMessage()}");
|
nlog("Mailer failed with {$e->getMessage()}");
|
||||||
|
|
||||||
$this->cleanUpMailers();
|
|
||||||
|
|
||||||
$message = $e->getMessage();
|
$message = $e->getMessage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,17 +116,32 @@ class EmailMailer implements ShouldQueue
|
|||||||
$message = $message_body->Message;
|
$message = $message_body->Message;
|
||||||
nlog($message);
|
nlog($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->fail();
|
||||||
|
$this->cleanUpMailers();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//only report once, not on all tries
|
||||||
|
if($this->attempts() == $this->tries)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* If the is an entity attached to the message send a failure mailer */
|
||||||
|
$this->entityEmailFailed($message);
|
||||||
|
|
||||||
|
/* Don't send postmark failures to Sentry */
|
||||||
|
if(Ninja::isHosted() && (!$e instanceof ClientException))
|
||||||
|
app('sentry')->captureException($e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the is an entity attached to the message send a failure mailer */
|
|
||||||
$this->entityEmailFailed($message);
|
|
||||||
|
|
||||||
/* Don't send postmark failures to Sentry */
|
/* Releasing immediately does not add in the backoff */
|
||||||
if(Ninja::isHosted() && (!$e instanceof ClientException))
|
$this->release($this->backoff()[$this->attempts()-1]);
|
||||||
app('sentry')->captureException($e);
|
|
||||||
|
|
||||||
$message = null;
|
$message = null;
|
||||||
|
$this->cleanUpMailers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user