From db19df0ff95e71564415dad3210e689a613668fd Mon Sep 17 00:00:00 2001 From: Linfly <45063822+imlinfly@users.noreply.github.com> Date: Thu, 12 Oct 2023 00:23:45 +0800 Subject: [PATCH] Update Event.php --- src/Events/Event.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Events/Event.php b/src/Events/Event.php index 3f1d81b1d..9534b8a78 100644 --- a/src/Events/Event.php +++ b/src/Events/Event.php @@ -102,7 +102,8 @@ public function delay(float $delay, callable $func, array $args = []): int { $className = $this->eventClassName; $timerId = $this->timerId++; - $event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args) { + $event = new $className($this->eventBase, -1, $className::TIMEOUT, function () use ($func, $args, $timerId) { + unset($this->eventTimer[$timerId]); try { $func(...$args); } catch (Throwable $e) {