From a61e83ff6a7cca8897beb8e2c7d2ebc870b17d90 Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 8 Jul 2026 13:49:46 +0800 Subject: [PATCH] Fix FileWatcher timer sentinel handling --- Abstracts/FileWatcher.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Abstracts/FileWatcher.php b/Abstracts/FileWatcher.php index 700758f..8bf537a 100644 --- a/Abstracts/FileWatcher.php +++ b/Abstracts/FileWatcher.php @@ -183,12 +183,12 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface $this->fswatchPipes = []; $this->stopFswatchProcess(); - if ($this->pollTimer) { + if ($this->pollTimer > 0) { Timer::clear($this->pollTimer); $this->pollTimer = -1; } - if ($this->debounceTimer) { + if ($this->debounceTimer > 0) { Timer::clear($this->debounceTimer); $this->debounceTimer = -1; } @@ -267,7 +267,7 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface return; } - if ($this->debounceTimer) { + if ($this->debounceTimer > 0) { Timer::clear($this->debounceTimer); } @@ -276,7 +276,7 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface $delay = max($this->debounceMs, $this->minReloadIntervalMs - $elapsed); $this->debounceTimer = Timer::after($delay, function () use ($changedFiles) { - $this->debounceTimer = null; + $this->debounceTimer = -1; $this->reload($changedFiles); }); }