fix cron using closure bug

This commit is contained in:
crazywhalecc
2023-01-18 00:43:16 +08:00
committed by Jerry
parent abc3cad836
commit ce0e7f7f39

View File

@@ -78,7 +78,7 @@ class Schedule
$this->executing[] = $cron;
// 新建一个协程运行排程任务,避免阻塞
Adaptive::getCoroutine()->create(function () use ($cron) {
$callable = [$cron->class, $cron->method];
$callable = $cron->class === '' ? $cron->method : [$cron->class, $cron->method];
container()->call($callable);
$this->executing = array_diff($this->executing, [$cron]);
});