mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Implement chunking of auto bill data
This commit is contained in:
parent
1ba73a3a54
commit
24364c5ffb
@ -62,8 +62,15 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_partial_invoices->count().' partial invoices to auto bill');
|
nlog($auto_bill_partial_invoices->count().' partial invoices to auto bill');
|
||||||
|
|
||||||
$auto_bill_partial_invoices->cursor()->each(function ($invoice) {
|
$auto_bill_partial_invoices->chunk(100, function ($invoices) {
|
||||||
AutoBill::dispatch($invoice->id, false);
|
|
||||||
|
foreach($invoices as $invoice)
|
||||||
|
{
|
||||||
|
AutoBill::dispatch($invoice->id, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
||||||
@ -79,8 +86,15 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_invoices->count().' full invoices to auto bill');
|
nlog($auto_bill_invoices->count().' full invoices to auto bill');
|
||||||
|
|
||||||
$auto_bill_invoices->cursor()->each(function ($invoice) {
|
$auto_bill_invoices->chunk(100, function ($invoices) {
|
||||||
AutoBill::dispatch($invoice->id, false);
|
|
||||||
|
foreach($invoices as $invoice)
|
||||||
|
{
|
||||||
|
AutoBill::dispatch($invoice->id, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//multiDB environment, need to
|
//multiDB environment, need to
|
||||||
@ -100,8 +114,14 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_partial_invoices->count()." partial invoices to auto bill db = {$db}");
|
nlog($auto_bill_partial_invoices->count()." partial invoices to auto bill db = {$db}");
|
||||||
|
|
||||||
$auto_bill_partial_invoices->cursor()->each(function ($invoice) use ($db) {
|
$auto_bill_partial_invoices->chunk(100, function ($invoices) use($db){
|
||||||
AutoBill::dispatch($invoice->id, $db);
|
|
||||||
|
foreach($invoices as $invoice)
|
||||||
|
{
|
||||||
|
AutoBill::dispatch($invoice->id, $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
||||||
@ -117,10 +137,15 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_invoices->count()." full invoices to auto bill db = {$db}");
|
nlog($auto_bill_invoices->count()." full invoices to auto bill db = {$db}");
|
||||||
|
|
||||||
$auto_bill_invoices->cursor()->each(function ($invoice) use ($db) {
|
$auto_bill_invoices->chunk(100, function ($invoices) use($db){
|
||||||
nlog($this->counter);
|
|
||||||
AutoBill::dispatch($invoice->id, $db);
|
foreach($invoices as $invoice)
|
||||||
$this->counter++;
|
{
|
||||||
|
AutoBill::dispatch($invoice->id, $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ trait Inviteable
|
|||||||
|
|
||||||
$qr = $writer->writeString($this->getPaymentLink(), 'utf-8');
|
$qr = $writer->writeString($this->getPaymentLink(), 'utf-8');
|
||||||
|
|
||||||
return "<svg viewBox='0 0 200 200' width='200' height='200' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
|
return "<svg class='pqrcode' viewBox='0 0 200 200' width='200' height='200' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
|
||||||
<rect x='0' y='0' width='100%'' height='100%' />{$qr}</svg>";
|
<rect x='0' y='0' width='100%'' height='100%' />{$qr}</svg>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user