From ce0e7f7f39eb5410d374270912631e6629a694b2 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 18 Jan 2023 00:43:16 +0800 Subject: [PATCH] fix cron using closure bug --- src/ZM/Schedule/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZM/Schedule/Schedule.php b/src/ZM/Schedule/Schedule.php index c785e2d2..3ad006eb 100644 --- a/src/ZM/Schedule/Schedule.php +++ b/src/ZM/Schedule/Schedule.php @@ -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]); });