Inject small delay when sending emails

This commit is contained in:
David Bomba 2021-07-07 18:43:34 +10:00
parent af8cd6f19d
commit 52c0bcbc18
3 changed files with 2 additions and 14 deletions

View File

@ -725,7 +725,7 @@ class InvoiceController extends BaseController
$invoice->service()->touchReminder($this->reminder_template)->deletePdf()->save(); $invoice->service()->touchReminder($this->reminder_template)->deletePdf()->save();
$invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) { $invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) {
EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template); EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template)->delay(now()->addSeconds(30));
}); });
if ($invoice->invitations->count() >= 1) { if ($invoice->invitations->count() >= 1) {

View File

@ -201,18 +201,8 @@ class CreateEntityPdf implements ShouldQueue
if(!Storage::disk($this->disk)->exists($path)) if(!Storage::disk($this->disk)->exists($path))
Storage::disk($this->disk)->makeDirectory($path, 0775); Storage::disk($this->disk)->makeDirectory($path, 0775);
// nlog($file_path);
Storage::disk($this->disk)->put($file_path, $pdf); Storage::disk($this->disk)->put($file_path, $pdf);
$path = Storage::disk($this->disk)->path($file_path);
$url = Storage::disk($this->disk)->url($file_path);
info("disk = " . $this->disk);
info($path);
info($url);
} }
catch(\Exception $e) catch(\Exception $e)

View File

@ -112,8 +112,6 @@ class InvoiceEmailEngine extends BaseEmailEngine
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
CreateEntityPdf::dispatchNow($this->invitation);
if(Ninja::isHosted()) if(Ninja::isHosted())
$this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]); $this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]);
else else