1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for latency when sending emails

This commit is contained in:
David Bomba 2022-12-03 09:50:55 +11:00
parent 14e86b8183
commit 5b63e0fd81
2 changed files with 4 additions and 1 deletions

View File

@ -136,11 +136,13 @@ class EmailController extends BaseController
}
$entity_obj->invitations->each(function ($invitation) use ($data, $entity_string, $entity_obj, $template) {
if (! $invitation->contact->trashed() && $invitation->contact->email) {
$entity_obj->service()->markSent()->save();
EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data)->delay(now()->addSeconds(2));
}
});
$entity_obj = $entity_obj->fresh();

View File

@ -90,7 +90,6 @@ class EmailEntity implements ShouldQueue
$this->template_data = $template_data;
$this->email_entity_builder = $this->resolveEmailBuilder();
}
/**
@ -106,6 +105,8 @@ class EmailEntity implements ShouldQueue
return;
}
$this->email_entity_builder = $this->resolveEmailBuilder();
/* Set DB */
MultiDB::setDB($this->company->db);