This commit is contained in:
as2252258@163.com
2021-03-20 02:46:29 +08:00
parent f075567e8f
commit 8a56598d73
+5 -4
View File
@@ -76,17 +76,18 @@ class CrontabProcess extends Process
private function jobDelivery($content) private function jobDelivery($content)
{ {
$content = unserialize($content); $content = unserialize($content);
var_dump($content);
$this->names[$content->getName()] = $content; $this->names[$content->getName()] = $content;
if (!($content instanceof Crontab)) { if (!($content instanceof Crontab)) {
return; return;
} }
$runTicker = [$content, 'execute']; $runTicker = function (Crontab $crontab) {
$crontab->execute();
};
$timer = $content->getTickTime() * 1000; $timer = $content->getTickTime() * 1000;
if ($content->isLoop()) { if ($content->isLoop()) {
$timerId = Timer::tick($timer, $runTicker); $timerId = Timer::tick($timer, $runTicker, $content);
} else { } else {
$timerId = Timer::after($timer, $runTicker); $timerId = Timer::after($timer, $runTicker, $content);
} }
$content->setTimerId($timerId); $content->setTimerId($timerId);
} }