Fix FileWatcher timer sentinel handling
This commit is contained in:
@@ -183,12 +183,12 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface
|
|||||||
$this->fswatchPipes = [];
|
$this->fswatchPipes = [];
|
||||||
$this->stopFswatchProcess();
|
$this->stopFswatchProcess();
|
||||||
|
|
||||||
if ($this->pollTimer) {
|
if ($this->pollTimer > 0) {
|
||||||
Timer::clear($this->pollTimer);
|
Timer::clear($this->pollTimer);
|
||||||
$this->pollTimer = -1;
|
$this->pollTimer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debounceTimer) {
|
if ($this->debounceTimer > 0) {
|
||||||
Timer::clear($this->debounceTimer);
|
Timer::clear($this->debounceTimer);
|
||||||
$this->debounceTimer = -1;
|
$this->debounceTimer = -1;
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debounceTimer) {
|
if ($this->debounceTimer > 0) {
|
||||||
Timer::clear($this->debounceTimer);
|
Timer::clear($this->debounceTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface
|
|||||||
$delay = max($this->debounceMs, $this->minReloadIntervalMs - $elapsed);
|
$delay = max($this->debounceMs, $this->minReloadIntervalMs - $elapsed);
|
||||||
|
|
||||||
$this->debounceTimer = Timer::after($delay, function () use ($changedFiles) {
|
$this->debounceTimer = Timer::after($delay, function () use ($changedFiles) {
|
||||||
$this->debounceTimer = null;
|
$this->debounceTimer = -1;
|
||||||
$this->reload($changedFiles);
|
$this->reload($changedFiles);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user