From 4a4b7db65133e29d275a9eb94cb7710875e1bd9f Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 20 Nov 2021 02:33:53 +0800 Subject: [PATCH] 1 --- kiri-engine/FileListen/Inotify.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kiri-engine/FileListen/Inotify.php b/kiri-engine/FileListen/Inotify.php index 7505ebf3..facd3ac0 100644 --- a/kiri-engine/FileListen/Inotify.php +++ b/kiri-engine/FileListen/Inotify.php @@ -4,6 +4,7 @@ namespace Kiri\FileListen; use Exception; use Swoole\Event; +use Swoole\Timer; class Inotify { @@ -74,7 +75,8 @@ class Inotify } //非重启类型 if (str_ends_with($ev['name'], '.php')) { - $this->reload(); + Timer::after(3000, fn()=>$this->reload()); + $this->isReloading = TRUE; } } } @@ -84,12 +86,6 @@ class Inotify */ public function reload() { - if ($this->isReloading) { - return; - } - - $this->isReloading = true; - $this->process->trigger_reload(); $this->clearWatch(); foreach ($this->dirs as $root) {