From dd4e9be06aee37ba2ab345fb275b8f617f14d2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 19 Nov 2021 18:25:54 +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 | 11 +++-------- kiri-engine/FileListen/Scaner.php | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/kiri-engine/FileListen/Inotify.php b/kiri-engine/FileListen/Inotify.php index ca94ed2b..6d2a4f68 100644 --- a/kiri-engine/FileListen/Inotify.php +++ b/kiri-engine/FileListen/Inotify.php @@ -61,11 +61,10 @@ class Inotify return; } if ($this->process->isReloading) { - if (!$this->process->isReloadingOut) { - $this->process->isReloadingOut = true; - } return; } + $this->process->isReloading = true; + $LISTEN_TYPE = [IN_CREATE, IN_DELETE, IN_MODIFY, IN_MOVED_TO, IN_MOVED_FROM]; foreach ($events as $ev) { if (!in_array($ev['mask'], $LISTEN_TYPE)) { @@ -73,6 +72,7 @@ class Inotify } //非重启类型 if (str_ends_with($ev['name'], '.php')) { + sleep(1); $this->reload(); } } @@ -83,10 +83,6 @@ 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) { @@ -94,7 +90,6 @@ class Inotify } $this->process->int = -1; $this->process->isReloading = FALSE; - $this->process->isReloadingOut = FALSE; } diff --git a/kiri-engine/FileListen/Scaner.php b/kiri-engine/FileListen/Scaner.php index ee83d480..f337d3ff 100644 --- a/kiri-engine/FileListen/Scaner.php +++ b/kiri-engine/FileListen/Scaner.php @@ -103,6 +103,9 @@ class Scaner */ public function timerReload() { + if ($this->process->isReloading) { + return; + } $this->process->isReloading = true; $this->process->trigger_reload();