This commit is contained in:
2021-11-20 02:33:53 +08:00
parent 905427bccc
commit 4a4b7db651
+3 -7
View File
@@ -4,6 +4,7 @@ namespace Kiri\FileListen;
use Exception; use Exception;
use Swoole\Event; use Swoole\Event;
use Swoole\Timer;
class Inotify class Inotify
{ {
@@ -74,7 +75,8 @@ class Inotify
} }
//非重启类型 //非重启类型
if (str_ends_with($ev['name'], '.php')) { 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() public function reload()
{ {
if ($this->isReloading) {
return;
}
$this->isReloading = true;
$this->process->trigger_reload(); $this->process->trigger_reload();
$this->clearWatch(); $this->clearWatch();
foreach ($this->dirs as $root) { foreach ($this->dirs as $root) {