mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Capture sending metrics
This commit is contained in:
parent
820070925a
commit
962ea9cc69
@ -40,7 +40,8 @@ class RecurringInvoicesCron
|
|||||||
public function handle() : void
|
public function handle() : void
|
||||||
{
|
{
|
||||||
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
||||||
nlog('Sending recurring invoices '.Carbon::now()->format('Y-m-d h:i:s'));
|
$start = Carbon::now()->format('Y-m-d h:i:s');
|
||||||
|
nlog('Sending recurring invoices '.$start);
|
||||||
|
|
||||||
if (! config('ninja.db.multi_db_enabled')) {
|
if (! config('ninja.db.multi_db_enabled')) {
|
||||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
||||||
@ -119,5 +120,8 @@ class RecurringInvoicesCron
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nlog("Recurring invoice send duration " . $start . " - " . Carbon::now()->format('Y-m-d h:i:s'));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
$invoice->invitations->each(function ($invitation) use ($invoice) {
|
$invoice->invitations->each(function ($invitation) use ($invoice) {
|
||||||
if ($invitation->contact && ! $invitation->contact->trashed() && strlen($invitation->contact->email) >= 1 && $invoice->client->getSetting('auto_email_invoice')) {
|
if ($invitation->contact && ! $invitation->contact->trashed() && strlen($invitation->contact->email) >= 1 && $invoice->client->getSetting('auto_email_invoice')) {
|
||||||
try {
|
try {
|
||||||
EmailEntity::dispatch($invitation, $invoice->company)->delay(10);
|
EmailEntity::dispatch($invitation, $invoice->company)->delay(rand(10,20));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
nlog($e->getMessage());
|
nlog($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -140,13 +140,13 @@ class SendRecurring implements ShouldQueue
|
|||||||
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
|
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
|
||||||
nlog("attempting to autobill {$invoice->number}");
|
nlog("attempting to autobill {$invoice->number}");
|
||||||
// $invoice->service()->autoBill();
|
// $invoice->service()->autoBill();
|
||||||
AutoBill::dispatch($invoice, $this->db)->delay(20);
|
AutoBill::dispatch($invoice, $this->db)->delay(rand(30,40));
|
||||||
|
|
||||||
} elseif ($invoice->client->getSetting('auto_bill_date') == 'on_due_date' && $invoice->auto_bill_enabled) {
|
} elseif ($invoice->client->getSetting('auto_bill_date') == 'on_due_date' && $invoice->auto_bill_enabled) {
|
||||||
if ($invoice->due_date && Carbon::parse($invoice->due_date)->startOfDay()->lte(now()->startOfDay())) {
|
if ($invoice->due_date && Carbon::parse($invoice->due_date)->startOfDay()->lte(now()->startOfDay())) {
|
||||||
nlog("attempting to autobill {$invoice->number}");
|
nlog("attempting to autobill {$invoice->number}");
|
||||||
// $invoice->service()->autoBill();
|
// $invoice->service()->autoBill();
|
||||||
AutoBill::dispatch($invoice, $this->db)->delay(20);
|
AutoBill::dispatch($invoice, $this->db)->delay(rand(30,40));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user