This commit is contained in:
as2252258@163.com
2021-03-20 03:11:59 +08:00
parent 6ec3813069
commit 2abe5bb6cf
+4 -4
View File
@@ -91,15 +91,15 @@ class CrontabProcess extends Process
{ {
/** @var Crontab $content */ /** @var Crontab $content */
$content = unserialize($content); $content = unserialize($content);
$runTicker = function (Crontab $crontab) { $runTicker = function () use ($content) {
$this->application->warning('execute crontab ' . date('Y-m-d H:i:s')); $this->application->warning('execute crontab ' . date('Y-m-d H:i:s'));
$crontab->execute($this); $content->execute($this);
}; };
$timer = $content->getTickTime() * 10; $timer = $content->getTickTime() * 10;
if ($content->isLoop()) { if ($content->isLoop()) {
$content->setTimerId(Timer::tick($timer, $runTicker, $content)); $content->setTimerId(Timer::tick($timer, $runTicker));
} else { } else {
$content->setTimerId(Timer::after($timer, $runTicker, $content)); $content->setTimerId(Timer::after($timer, $runTicker));
} }
$this->names[$content->getName()] = $content; $this->names[$content->getName()] = $content;
} }