From 14c505c15bd3691bf6eab01c82dc2b9d4beda7a2 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 12 May 2024 14:56:18 +1000 Subject: [PATCH] Must not cache the mail waiting queries, otherwise mail/files will be resent in a query loop --- app/Classes/File/Mail.php | 5 +++++ app/Models/Address.php | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Classes/File/Mail.php b/app/Classes/File/Mail.php index a840e9d..590a5de 100644 --- a/app/Classes/File/Mail.php +++ b/app/Classes/File/Mail.php @@ -5,12 +5,15 @@ namespace App\Classes\File; use Carbon\Carbon; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use App\Classes\Node; use App\Classes\FTN\{Message,Packet}; final class Mail extends Send { + private const LOGKEY = 'IFM'; + /** @var int Our internal position counter */ private int $readpos; @@ -56,6 +59,8 @@ final class Mail extends Send if ($successful) { $this->complete = TRUE; + Log::debug(sprintf('%s:- Successful close for [%d] - updating [%d] records.',self::LOGKEY,$this->type,$this->dbids->count()),['dbids'=>$this->dbids,'authd'=>$node->aka_remote_authed->pluck('id')]); + // Update netmail table if (($this->type === Send::T_NETMAIL) && ($x=$this->dbids)->count()) diff --git a/app/Models/Address.php b/app/Models/Address.php index 60f37c0..5e4f415 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -366,7 +366,8 @@ class Address extends Model ->whereNotNull('export_at') ->whereNull('sent_at') ->whereNull('echomails.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } public function scopeUncollectedEchomailTotal($query) @@ -400,7 +401,8 @@ class Address extends Model ->whereNotNull('export_at') ->whereNull('sent_at') ->whereNull('files.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } public function scopeUncollectedFilesTotal($query) @@ -432,7 +434,8 @@ class Address extends Model ->whereNull('sent_pkt') ->whereNull('sent_at') ->whereNull('netmails.deleted_at') - ->groupBy('addresses.id'); + ->groupBy('addresses.id') + ->dontCache(); } /**