From 767f7265128b6c6082e9b98d8258e35071647614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 17 Nov 2020 16:49:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Process/ServerInotify.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/System/Process/ServerInotify.php b/System/Process/ServerInotify.php index d40c956a..008c6f6e 100644 --- a/System/Process/ServerInotify.php +++ b/System/Process/ServerInotify.php @@ -51,7 +51,7 @@ class ServerInotify extends Process foreach ($this->dirs as $dir) { $this->loadByDir($dir); } - Timer::tick(2000, [$this, 'tick']); + Timer::after(2000, [$this, 'tick']); } } @@ -67,6 +67,10 @@ class ServerInotify extends Process foreach ($this->dirs as $dir) { $this->loadByDir($dir, true); } + if ($this->isReloading) { + return; + } + Timer::after(2000, [$this, 'tick']); } @@ -92,7 +96,6 @@ class ServerInotify extends Process if (!isset($this->md5Map[$md5])) { if ($isReload) { $this->isReloading = true; - Timer::clearAll(); return Timer::after(2000, [$this, 'timerReload']); } $this->md5Map[$md5] = $mTime; @@ -100,7 +103,6 @@ class ServerInotify extends Process if ($this->md5Map[$md5] != $mTime) { if ($isReload) { $this->isReloading = true; - Timer::clearAll(); return Timer::after(2000, [$this, 'timerReload']); } $this->md5Map[$md5] = $mTime; @@ -177,13 +179,14 @@ class ServerInotify extends Process $this->isReloading = true; $this->trigger_reload(); $this->int = -1; - $this->isReloading = FALSE; - $this->isReloadingOut = FALSE; $this->md5Map = []; $this->loadByDir(APP_PATH . 'app'); $this->loadByDir(APP_PATH . 'routes'); - Timer::tick(2000, [$this, 'tick']); + $this->isReloading = FALSE; + $this->isReloadingOut = FALSE; + + Timer::after(2000, [$this, 'tick']); } /**