HubStats(Carbon::now()) ->get() ->transform(function($item) { 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(function($item) { 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) { 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)); } } } }