Skip to content

Commit 7043031

Browse files
committed
Fix timersGc iteration in LibEventLoop
1 parent f8f30a7 commit 7043031

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

LibEventLoop.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
161161
throw new \InvalidArgumentException('The callback must be a callable object.');
162162
}
163163

164-
while($resource = $this->timersGc->dequeue()){
164+
foreach ($this->timersGc as $resource) {
165165
event_free($resource);
166166
}
167167

@@ -182,8 +182,7 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
182182

183183
if ($timer->periodic === true) {
184184
event_add($timer->resource, $timer->interval);
185-
}
186-
else {
185+
} else {
187186
$this->cancelTimer($timer->signature);
188187
}
189188
}

0 commit comments

Comments
 (0)