diff --git a/kiri-engine/FileListen/FileChangeCustomProcess.php b/kiri-engine/FileListen/FileChangeCustomProcess.php index d68f17df..7b177342 100644 --- a/kiri-engine/FileListen/FileChangeCustomProcess.php +++ b/kiri-engine/FileListen/FileChangeCustomProcess.php @@ -57,7 +57,7 @@ class FileChangeCustomProcess extends Command public function execute(InputInterface $input, OutputInterface $output): int { // TODO: Implement onHandler() method. - set_error_handler([$this, 'onErrorHandler']); +// set_error_handler([$this, 'onErrorHandler']); $this->dirs = Config::get('inotify', [APP_PATH . 'app']); if (!extension_loaded('inotify')) { diff --git a/kiri-engine/FileListen/Inotify.php b/kiri-engine/FileListen/Inotify.php index 721c7f37..012ac96e 100644 --- a/kiri-engine/FileListen/Inotify.php +++ b/kiri-engine/FileListen/Inotify.php @@ -45,11 +45,10 @@ class Inotify } - - - /** - * 开始监听 - */ + /** + * 开始监听 + * @throws Exception + */ public function check() { if (!($events = inotify_read($this->inotify))) { @@ -68,12 +67,10 @@ class Inotify } //非重启类型 if (str_ends_with($ev['name'], '.php')) { - if ($this->process->int !== -1) { + if ($this->process->isReloading) { return; } - $this->process->int = @swoole_timer_after(2000, [$this, 'reload']); - - $this->process->isReloading = true; + $this->reload(); } } }