Skip to content

Commit

Permalink
Update Event.php
Browse files Browse the repository at this point in the history
  • Loading branch information
imlinfly authored Oct 11, 2023
1 parent 74bce26 commit db19df0
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 db19df0

Please sign in to comment.