Fixes for SendReminders firing twice

This commit is contained in:
David Bomba 2022-11-24 15:43:14 +11:00
parent 4ea0d03b5c
commit 29d909ad08
2 changed files with 11 additions and 2 deletions

View File

@ -50,11 +50,20 @@ class ReminderJob implements ShouldQueue
$this->processReminders(); $this->processReminders();
} else { } else {
//multiDB environment, need to //multiDB environment, need to
/*
foreach (MultiDB::$dbs as $db) { foreach (MultiDB::$dbs as $db) {
MultiDB::setDB($db); MultiDB::setDB($db);
nlog("set db {$db}"); nlog("set db {$db}");
$this->processReminders(); $this->processReminders();
} }
*/
//24-11-2022 fix for potential memory leak during a long running process, the second reminder may run twice
foreach (config('ninja.dbs') as $db) {
MultiDB::setDB($db);
nlog("set db {$db}");
$this->processReminders();
}
} }
} }
@ -79,9 +88,8 @@ class ReminderJob implements ShouldQueue
if ($invoice->isPayable()) { if ($invoice->isPayable()) {
$reminder_template = $invoice->calculateTemplate('invoice'); $reminder_template = $invoice->calculateTemplate('invoice');
nlog("reminder template = {$reminder_template}"); nlog("reminder template = {$reminder_template}");
$invoice->service()->touchReminder($reminder_template)->save();
$invoice = $this->calcLateFee($invoice, $reminder_template); $invoice = $this->calcLateFee($invoice, $reminder_template);
$invoice->service()->touchReminder($reminder_template)->save();
$invoice->service()->touchPdf(); $invoice->service()->touchPdf();
//20-04-2022 fixes for endless reminders - generic template naming was wrong //20-04-2022 fixes for endless reminders - generic template naming was wrong

View File

@ -211,4 +211,5 @@ return [
'dev_mode' => env("YODLEE_DEV_MODE", false), 'dev_mode' => env("YODLEE_DEV_MODE", false),
'config_name' => env("YODLEE_CONFIG_NAME", false), 'config_name' => env("YODLEE_CONFIG_NAME", false),
], ],
'dbs' => ['db-ninja-01','db-ninja-02']
]; ];