Improve memory handling

This commit is contained in:
David Bomba 2022-11-01 22:23:52 +11:00
parent dddfd32757
commit 33fdd0000c
2 changed files with 6 additions and 5 deletions

View File

@ -112,6 +112,8 @@ class SelfUpdateController extends BaseController
$zipFile->close();
$zipFile = null;
nlog('Finished extracting files');
unlink($file);

View File

@ -129,12 +129,11 @@ class NinjaMailerJob implements ShouldQueue
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
->send();
nlog('Using ' . ((int) (memory_get_usage(true) / (1024 * 1024))) . 'MB ');
// nlog('Using ' . ((int) (memory_get_usage(true) / (1024 * 1024))) . 'MB ');
$this->nmo = null;
$this->company = null;
gc_collect_cycles();
app('queue.worker')->shouldQuit = 1;
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {
@ -177,7 +176,7 @@ class NinjaMailerJob implements ShouldQueue
$message = null;
$this->nmo = null;
$this->company = null;
gc_collect_cycles();
app('queue.worker')->shouldQuit = 1;
}
@ -204,7 +203,7 @@ class NinjaMailerJob implements ShouldQueue
if ($this->nmo->to_user instanceof ClientContact)
$this->logMailError($message, $this->nmo->to_user->client);
}
private function setMailDriver()