From 7e43775b046a37eb72eff449d4196a552e58517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 19 Nov 2021 18:27:17 +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 --- kiri-engine/FileListen/Inotify.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kiri-engine/FileListen/Inotify.php b/kiri-engine/FileListen/Inotify.php index 6d2a4f68..77c02018 100644 --- a/kiri-engine/FileListen/Inotify.php +++ b/kiri-engine/FileListen/Inotify.php @@ -63,7 +63,6 @@ class Inotify if ($this->process->isReloading) { return; } - $this->process->isReloading = true; $LISTEN_TYPE = [IN_CREATE, IN_DELETE, IN_MODIFY, IN_MOVED_TO, IN_MOVED_FROM]; foreach ($events as $ev) { @@ -72,7 +71,6 @@ class Inotify } //非重启类型 if (str_ends_with($ev['name'], '.php')) { - sleep(1); $this->reload(); } } @@ -83,6 +81,12 @@ class Inotify */ public function reload() { + if ($this->process->isReloading) { + return; + } + + $this->process->isReloading = true; + $this->process->trigger_reload(); $this->clearWatch(); foreach ($this->dirs as $root) {