Browse Source

Merge pull request #965 from imlinfly/patch-1

Update Event.php
walkor 2 years ago
parent
commit
bd44bd4929
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Events/Event.php

+ 2 - 1
src/Events/Event.php

@@ -102,7 +102,8 @@ class Event implements EventInterface
     {
         $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) {