From de05d5099cb00ee00f45326a5fab1c4fbcb9a2a0 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sat, 20 Mar 2021 03:39:11 +0800 Subject: [PATCH] modify --- System/Process/CrontabProcess.php | 37 +++++++++---------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/System/Process/CrontabProcess.php b/System/Process/CrontabProcess.php index 734e4bab..8cf737b8 100644 --- a/System/Process/CrontabProcess.php +++ b/System/Process/CrontabProcess.php @@ -116,34 +116,17 @@ class CrontabProcess extends Process { /** @var Crontab $content */ $content = unserialize($content); -// $runTicker = function () use ($content) { -// $this->application->warning('execute crontab ' . date('Y-m-d H:i:s')); -// $content->execute($this); -// }; -// $timer = $content->getTickTime() * 10; - - - var_dump(serialize($content)); - - Timer::after(3000, function () use ($content) { + $runTicker = function () use ($content) { $this->application->warning('execute crontab ' . date('Y-m-d H:i:s')); -// $content->execute($this); - }); - - var_dump(Timer::stats()); - -// if ($content->isLoop()) { -// $content->setTimerId(Timer::tick($timer, function () use ($content) { -// $this->application->warning('execute crontab ' . date('Y-m-d H:i:s')); -// $content->execute($this); -// })); -// } else { -// $content->setTimerId(Timer::after($timer, function () use ($content) { -// $this->application->warning('execute crontab ' . date('Y-m-d H:i:s')); -// $content->execute($this); -// })); -// } -// $this->names[$content->getName()] = $content; + $content->execute($this); + }; + $timer = $content->getTickTime() * 10; + if ($content->isLoop()) { + $content->setTimerId(Timer::tick($timer, $runTicker)); + } else { + $content->setTimerId(Timer::after($timer, $runTicker)); + } + $this->names[$content->getName()] = $content; }