Skip to content

Commit

Permalink
Merge pull request #965 from imlinfly/patch-1
Browse files Browse the repository at this point in the history
Update Event.php
  • Loading branch information
walkor authored Oct 31, 2023
2 parents 443fa0e + db19df0 commit bd44bd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bd44bd4

Please sign in to comment.