mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improve memory handling in jobs
This commit is contained in:
parent
b7b49441f6
commit
de8761f519
@ -219,6 +219,12 @@ class CreateEntityPdf implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->invitation = null;
|
||||||
|
$this->entity = null;
|
||||||
|
$this->company = null;
|
||||||
|
$this->client = null;
|
||||||
|
$this->contact = null;
|
||||||
|
|
||||||
return $file_path;
|
return $file_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +128,9 @@ class EmailEntity implements ShouldQueue
|
|||||||
$nmo->entity = $this->entity;
|
$nmo->entity = $this->entity;
|
||||||
|
|
||||||
(new NinjaMailerJob($nmo))->handle();
|
(new NinjaMailerJob($nmo))->handle();
|
||||||
|
|
||||||
|
$nmo = null;
|
||||||
|
$this->invitation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resolveEntityString() :string
|
private function resolveEntityString() :string
|
||||||
|
@ -115,6 +115,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
|
|
||||||
//send email
|
//send email
|
||||||
try {
|
try {
|
||||||
|
|
||||||
nlog("trying to send to {$this->nmo->to_user->email} ". now()->toDateTimeString());
|
nlog("trying to send to {$this->nmo->to_user->email} ". now()->toDateTimeString());
|
||||||
nlog("Using mailer => ". $this->mailer);
|
nlog("Using mailer => ". $this->mailer);
|
||||||
|
|
||||||
@ -128,6 +129,8 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
|
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
|
$this->nmo = null;
|
||||||
|
$this->company = null;
|
||||||
|
|
||||||
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
|
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
|
||||||
|
|
||||||
@ -381,7 +384,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
private function logMailError($errors, $recipient_object)
|
private function logMailError($errors, $recipient_object)
|
||||||
{
|
{
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatchSync(
|
||||||
$errors,
|
$errors,
|
||||||
SystemLog::CATEGORY_MAIL,
|
SystemLog::CATEGORY_MAIL,
|
||||||
SystemLog::EVENT_MAIL_SEND,
|
SystemLog::EVENT_MAIL_SEND,
|
||||||
@ -396,6 +399,9 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
|
|
||||||
LightLogs::create($job_failure)
|
LightLogs::create($job_failure)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
|
$job_failure = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function failed($exception = null)
|
public function failed($exception = null)
|
||||||
|
@ -79,11 +79,22 @@ class SystemLogger implements ShouldQueue
|
|||||||
|
|
||||||
if (! $this->log) {
|
if (! $this->log) {
|
||||||
nlog('SystemLogger:: no log to store');
|
nlog('SystemLogger:: no log to store');
|
||||||
|
$this->category_id = null;
|
||||||
|
$this->event_id = null;
|
||||||
|
$this->type_id = null;
|
||||||
|
$this->client = null;
|
||||||
|
$this->company = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemLog::create($sl);
|
SystemLog::create($sl);
|
||||||
|
|
||||||
|
$this->log = null;
|
||||||
|
$this->category_id = null;
|
||||||
|
$this->event_id = null;
|
||||||
|
$this->type_id = null;
|
||||||
|
$this->client = null;
|
||||||
|
$this->company = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function failed($e)
|
public function failed($e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user