1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Reduce touch events

This commit is contained in:
David Bomba 2024-09-30 15:38:10 +10:00
parent 67a7449ffc
commit 847c2cce66
3 changed files with 17 additions and 22 deletions

View File

@ -179,7 +179,7 @@ class ProcessMailgunWebhook implements ShouldQueue
private function processOpen() private function processOpen()
{ {
$this->invitation->opened_date = now(); $this->invitation->opened_date = now();
$this->invitation->save(); $this->invitation->saveQuietly();
$sl = $this->getSystemLog($this->request['MessageID']); $sl = $this->getSystemLog($this->request['MessageID']);
@ -272,7 +272,7 @@ class ProcessMailgunWebhook implements ShouldQueue
private function processDelivery() private function processDelivery()
{ {
$this->invitation->email_status = 'delivered'; $this->invitation->email_status = 'delivered';
$this->invitation->save(); $this->invitation->saveQuietly();
$sl = $this->getSystemLog($this->request['MessageID']); $sl = $this->getSystemLog($this->request['MessageID']);
@ -359,7 +359,7 @@ class ProcessMailgunWebhook implements ShouldQueue
private function processBounce() private function processBounce()
{ {
$this->invitation->email_status = 'bounced'; $this->invitation->email_status = 'bounced';
$this->invitation->save(); $this->invitation->saveQuietly();
$bounce = new EmailBounce( $bounce = new EmailBounce(
$this->request['event-data']['tags'][0], $this->request['event-data']['tags'][0],
@ -433,7 +433,7 @@ class ProcessMailgunWebhook implements ShouldQueue
private function processSpamComplaint() private function processSpamComplaint()
{ {
$this->invitation->email_status = 'spam'; $this->invitation->email_status = 'spam';
$this->invitation->save(); $this->invitation->saveQuietly();
$spam = new EmailSpam( $spam = new EmailSpam(
$this->request['event-data']['tags'][0], $this->request['event-data']['tags'][0],

View File

@ -165,7 +165,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
private function processOpen() private function processOpen()
{ {
$this->invitation->opened_date = now(); $this->invitation->opened_date = now();
$this->invitation->save(); $this->invitation->saveQuietly();
$data = array_merge($this->request, ['history' => $this->fetchMessage()]); $data = array_merge($this->request, ['history' => $this->fetchMessage()]);
@ -205,7 +205,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
private function processDelivery() private function processDelivery()
{ {
$this->invitation->email_status = 'delivered'; $this->invitation->email_status = 'delivered';
$this->invitation->save(); $this->invitation->saveQuietly();
$data = array_merge($this->request, ['history' => $this->fetchMessage()]); $data = array_merge($this->request, ['history' => $this->fetchMessage()]);
@ -257,7 +257,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
private function processBounce() private function processBounce()
{ {
$this->invitation->email_status = 'bounced'; $this->invitation->email_status = 'bounced';
$this->invitation->save(); $this->invitation->saveQuietly();
$bounce = new EmailBounce( $bounce = new EmailBounce(
$this->request['Tag'], $this->request['Tag'],
@ -308,7 +308,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
private function processSpamComplaint() private function processSpamComplaint()
{ {
$this->invitation->email_status = 'spam'; $this->invitation->email_status = 'spam';
$this->invitation->save(); $this->invitation->saveQuietly();
$spam = new EmailSpam( $spam = new EmailSpam(
$this->request['Tag'], $this->request['Tag'],

View File

@ -71,12 +71,10 @@ class ReminderJob implements ShouldQueue
->whereHas('company', function ($query) { ->whereHas('company', function ($query) {
$query->where('is_disabled', 0); $query->where('is_disabled', 0);
}) })
->with('invitations')->chunk(800, function ($invoices) { ->with('invitations')
foreach ($invoices as $invoice) { ->cursor()
->each(function ($invoice) {
$this->sendReminderForInvoice($invoice); $this->sendReminderForInvoice($invoice);
}
sleep(1);
}); });
} else { } else {
//multiDB environment, need to //multiDB environment, need to
@ -99,13 +97,10 @@ class ReminderJob implements ShouldQueue
->whereHas('company', function ($query) { ->whereHas('company', function ($query) {
$query->where('is_disabled', 0); $query->where('is_disabled', 0);
}) })
->with('invitations')->chunk(800, function ($invoices) { ->with('invitations')
->cursor()
foreach ($invoices as $invoice) { ->each(function ($invoice) {
$this->sendReminderForInvoice($invoice); $this->sendReminderForInvoice($invoice);
}
sleep(1);
}); });
} }
} }