diff --git a/CHANGELOG.md b/CHANGELOG.md index 1718884..5259268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ### HEAD +- n/a + +v1.0.0-beta2 +------------ + +- Fixed bug causing every NativeReactor tick to last one second (lol) - Fixed bug preventing correct resolution of any() combinator promise when passed an empty array - Suggest nearby property name in Struct error messages diff --git a/lib/NativeReactor.php b/lib/NativeReactor.php index 3319050..92b6c67 100644 --- a/lib/NativeReactor.php +++ b/lib/NativeReactor.php @@ -221,7 +221,7 @@ class NativeReactor implements Reactor { if ($watcher->type === Watcher::TIMER_REPEAT && $watcher->isEnabled) { $this->isTimerSortNeeded = true; $watcher->nextExecutionAt = $now + $watcher->msInterval; - if ($watcher->nextExecutionAt < $this->nextTimerAt) { + if (!isset($this->nextTimerAt) || $watcher->nextExecutionAt < $this->nextTimerAt) { $this->nextTimerAt = $watcher->nextExecutionAt; } $this->timerOrder[$watcherId] = $watcher->nextExecutionAt; @@ -278,7 +278,7 @@ class NativeReactor implements Reactor { $watcher->nextExecutionAt = $nextExecutionAt; $this->timerOrder[$watcherId] = $nextExecutionAt; $this->isTimerSortNeeded = true; - if ($nextExecutionAt < $this->nextTimerAt) { + if (!isset($this->nextTimerAt) || $nextExecutionAt < $this->nextTimerAt) { $this->nextTimerAt = $nextExecutionAt; } } @@ -317,7 +317,7 @@ class NativeReactor implements Reactor { $nextExecutionAt = microtime(true) + $increment; $this->timerOrder[$watcherId] = $watcher->nextExecutionAt = $nextExecutionAt; $this->isTimerSortNeeded = true; - if ($nextExecutionAt < $this->nextTimerAt) { + if (!isset($this->nextTimerAt) || $nextExecutionAt < $this->nextTimerAt) { $this->nextTimerAt = $nextExecutionAt; } }