1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Fixed bug causing every NativeReactor tick to last one second (lol)

This commit is contained in:
Daniel Lowrey 2015-05-17 19:52:41 -04:00
parent 631a6089d9
commit aa27ab7a10
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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;
}
}