This commit is contained in:
as2252258@163.com
2021-03-20 02:56:21 +08:00
parent 0b6386ce90
commit 4d30a866bf
2 changed files with 21 additions and 6 deletions
+16 -5
View File
@@ -56,14 +56,13 @@ class CrontabProcess extends Process
{
call_user_func(match ($content['action']) {
'clear' => function ($content) {
if (!isset($this->names[$content['name']])) {
return;
}
$this->names[$content['name']]->clearTimer();
$this->clear($content['name']);
},
'clearAll' => function () {
foreach ($this->names as $name => $crontab) {
$crontab->clearTimer();
unset($this->names[$name], $crontab);
}
},
default => function () {
@@ -73,6 +72,18 @@ class CrontabProcess extends Process
}
/**
* @param string $name
*/
public function clear(string $name)
{
if (!isset($this->names[$name])) {
return;
}
$this->names[$name]->clearTimer();
}
/**
* @param $content
*/
@@ -82,7 +93,7 @@ class CrontabProcess extends Process
$content = unserialize($content);
$runTicker = function (Crontab $crontab) {
var_dump(get_called_class());
$crontab->execute();
$crontab->execute($this);
};
$timer = $content->getTickTime() * 1000;
var_dump($timer);