bump sleep for failed sends

This commit is contained in:
David Bomba 2024-04-19 10:32:16 +10:00
parent 28a2695ef8
commit edf5947316
3 changed files with 13 additions and 11 deletions

View File

@ -110,7 +110,9 @@ class DemoMode extends Command
$this->info('Creating Small Account and Company');
$account = Account::factory()->create();
$account = Account::factory()->create([
"set_react_as_default_ap" => 0,
]);
$company = Company::factory()->create([
'account_id' => $account->id,
'slack_webhook_url' => config('ninja.notification.slack'),

View File

@ -223,7 +223,7 @@ class NinjaMailerJob implements ShouldQueue
}
/* Releasing immediately does not add in the backoff */
sleep(rand(0, 3));
sleep(rand(5, 10));
$this->release($this->backoff()[$this->attempts() - 1]);
}

View File

@ -150,19 +150,19 @@ class AutoBillInvoice extends AbstractService
->setPaymentHash($payment_hash)
->tokenBilling($gateway_token, $payment_hash);
} catch (\Exception $e) {
$this->invoice->auto_bill_tries += 1;
if ($this->invoice->auto_bill_tries == 3) {
$this->invoice->auto_bill_enabled = false;
$this->invoice->auto_bill_tries = 0; //reset the counter here in case auto billing is turned on again in the future.
$this->invoice->save();
}
$this->invoice->save();
nlog('payment NOT captured for '.$this->invoice->number.' with error '.$e->getMessage());
}
$this->invoice->auto_bill_tries += 1;
if ($this->invoice->auto_bill_tries == 3) {
$this->invoice->auto_bill_enabled = false;
$this->invoice->auto_bill_tries = 0; //reset the counter here in case auto billing is turned on again in the future.
}
$this->invoice->save();
if ($payment) {
info('Auto Bill payment captured for '.$this->invoice->number);
}