/** * daemon: rely check */ public function runAction(&$log) { $oTask = new Task(); $oRely = new Rely(); while (true) { Log::info("loop check rely."); $taskArr = $oTask->pending(); foreach ($taskArr as $task) { $ready = true; $relyArr = $oRely->job($task['job_id']); foreach ($relyArr as $rely) { $ready = $oTask->check($task['time'], $rely['rely_job'], $rely['start'], $rely['long'], $rely['freq']); Log::info("rely check [job_id:" . $task['job_id'] . "] [rely_job:" . $rely['rely_job'] . "] [time:" . $task['time'] . "] [ready:" . intval($ready) . "]"); if (!$ready) { break; } } if ($ready) { Log::info("rely ready [job_id:" . $task['job_id'] . "] [time:" . $task['time'] . "]"); $oTask->setReady($task['job_id'], $task['time']); } } sleep(3); } }
/** * set a task to ready */ public function readyAction() { $job_id = $this->params['job_id']; $time = $this->params['time']; $oTask = new Task(); $oTask->setReady($job_id, $time); }