mode = $mode; } /** * Execute the job. */ public function handle(): void { // Return the system we poll $u = $this ->HubStats(Carbon::now()) ->get() ->transform(function($item) { // Add the list of queued items to the uplink if ($x=$item->uplink()) { $x->uncollected_echomail = $item->uncollected_echomail; $x->uncollected_netmail = $item->uncollected_netmail; $x->uncollected_files = $item->uncollected_files; return $x; } else { return $item; } }) ->filter(fn($item)=>(! $item->system->autohold) // System is not on autohold && (is_null($this->mode) // If we didnt specify a poll mode, poll anyway || ($item->system->pollmode) // If system poll mode is set to crash || ($item->system->pollmode === $this->mode))); // If the sytem poll mode is the same as mode calling this send foreach ($u->groupBy('ftn') as $oo) { if (! Job::where('queue','poll')->get()->pluck('command.address.id')->contains(($x=$oo->first())->id)) { Log::info(sprintf('%s:- Polling [%s] - we have mail for [%d] links. (%d Netmail,%d Echomail,%d Files)', self::LOGKEY, $x->ftn, $oo->count(), $oo->sum('uncollected_netmail'), $oo->sum('uncollected_echomail'), $oo->sum('uncollected_files'), )); AddressPoll::dispatch($x); } else { Log::notice(sprintf('%s:= Not scheduling poll to [%s], there is already one in the queue',self::LOGKEY,$x->ftn)); } } } }