This commit is contained in:
2021-11-19 18:27:17 +08:00
parent dd4e9be06a
commit 7e43775b04
+6 -2
View File
@@ -63,7 +63,6 @@ class Inotify
if ($this->process->isReloading) { if ($this->process->isReloading) {
return; return;
} }
$this->process->isReloading = true;
$LISTEN_TYPE = [IN_CREATE, IN_DELETE, IN_MODIFY, IN_MOVED_TO, IN_MOVED_FROM]; $LISTEN_TYPE = [IN_CREATE, IN_DELETE, IN_MODIFY, IN_MOVED_TO, IN_MOVED_FROM];
foreach ($events as $ev) { foreach ($events as $ev) {
@@ -72,7 +71,6 @@ class Inotify
} }
//非重启类型 //非重启类型
if (str_ends_with($ev['name'], '.php')) { if (str_ends_with($ev['name'], '.php')) {
sleep(1);
$this->reload(); $this->reload();
} }
} }
@@ -83,6 +81,12 @@ class Inotify
*/ */
public function reload() public function reload()
{ {
if ($this->process->isReloading) {
return;
}
$this->process->isReloading = true;
$this->process->trigger_reload(); $this->process->trigger_reload();
$this->clearWatch(); $this->clearWatch();
foreach ($this->dirs as $root) { foreach ($this->dirs as $root) {