cronWorkerScheduler = $cronWorkerScheduler; } public function init() { if (!$this->bridge) { $this->bridge = new Bridge(); } } public function processTaskStrategy(ScheduledTaskEntity $task, $timer) { try { $result = $this->checkKey(); } catch (\Exception $e) { $result = false; } if (empty($result['code']) || $result['code'] == Bridge::CHECK_ERROR_UNAVAILABLE) { $this->cronWorkerScheduler->rescheduleProgressively($task); return false; } return true; } public function getNextRunDate() { $date = Carbon::now()->millisecond(0); return $date->startOfDay() ->addDay() ->addHours(rand(0, 5)) ->addMinutes(rand(0, 59)) ->addSeconds(rand(0, 59)); } public abstract function checkKey(); }