From b34b046d3c7afa853b259d2a29efca13b53979fb Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 26 Jun 2024 16:47:10 +1000 Subject: [PATCH] Fix polling for messages sent via uplinks, where those systems which had a status of HOLD --- app/Jobs/MailSend.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/Jobs/MailSend.php b/app/Jobs/MailSend.php index bc26dbe..309b693 100644 --- a/app/Jobs/MailSend.php +++ b/app/Jobs/MailSend.php @@ -48,21 +48,6 @@ class MailSend #implements ShouldQueue ->join('systems',['systems.id'=>'a.system_id']) ->join('zones',['zones.id'=>'a.zone_id']) ->join('domains',['domains.id'=>'zones.domain_id']) - ->where(function($query) { - return $query->whereNull('autohold') - ->orWhere('autohold',FALSE); - }) - ->when(! is_null($this->crash),function($query) { - return $query->when( - $this->crash, - function($query) { - return $query->where('pollmode',$this->crash); - }, - function($query) { - return $query->whereNotNull('pollmode'); - } - ); - }) ->groupBy('a.system_id','a.id','a.zone_id','addresses.region_id','a.host_id','a.node_id','a.point_id','addresses.hub_id','addresses.role') ->with(['system','zone.domain']) ->dontCache() @@ -80,7 +65,14 @@ class MailSend #implements ShouldQueue } else { return $item; } - }); + }) + ->filter(function($item) { + if ($item->ftn3d === '1337:1/100') dump(['item'=>$item,'ftn'=>$item->ftn,'autohold'=>$item->system->authold,'pollmode'=>$item->system->pollmode,'crash'=>$this->crash]); + if ($item->system->autohold) + return NULL; + + return is_null($this->crash) || ($item->system->pollmode) || ($item->system->pollmode === $this->crash) ? $item : NULL; + }); foreach ($u->groupBy('ftn') as $oo) { if (Job::where('queue','poll')->get()->pluck('command.address.id')->search(($x=$oo->first())->id) === FALSE) {