This commit is contained in:
2021-11-19 18:21:59 +08:00
parent ef95f912cb
commit f4f48ebad7
+8 -5
View File
@@ -51,10 +51,10 @@ class Inotify
} }
/** /**
* 开始监听 * 开始监听
* @throws Exception * @throws Exception
*/ */
public function check() public function check()
{ {
if (!($events = inotify_read($this->inotify))) { if (!($events = inotify_read($this->inotify))) {
@@ -73,7 +73,7 @@ class Inotify
} }
//非重启类型 //非重启类型
if (str_ends_with($ev['name'], '.php')) { if (str_ends_with($ev['name'], '.php')) {
sleep(2); sleep(2);
$this->reload(); $this->reload();
} }
} }
@@ -84,6 +84,9 @@ class Inotify
*/ */
public function reload() public function reload()
{ {
if ($this->process->isReloading) {
return;
}
$this->process->isReloading = true; $this->process->isReloading = true;
$this->process->trigger_reload(); $this->process->trigger_reload();
$this->clearWatch(); $this->clearWatch();