This commit is contained in:
2021-11-19 18:25:54 +08:00
parent 73b01c288b
commit dd4e9be06a
2 changed files with 6 additions and 8 deletions
+3 -8
View File
@@ -61,11 +61,10 @@ class Inotify
return;
}
if ($this->process->isReloading) {
if (!$this->process->isReloadingOut) {
$this->process->isReloadingOut = true;
}
return;
}
$this->process->isReloading = true;
$LISTEN_TYPE = [IN_CREATE, IN_DELETE, IN_MODIFY, IN_MOVED_TO, IN_MOVED_FROM];
foreach ($events as $ev) {
if (!in_array($ev['mask'], $LISTEN_TYPE)) {
@@ -73,6 +72,7 @@ class Inotify
}
//非重启类型
if (str_ends_with($ev['name'], '.php')) {
sleep(1);
$this->reload();
}
}
@@ -83,10 +83,6 @@ class Inotify
*/
public function reload()
{
if ($this->process->isReloading) {
return;
}
$this->process->isReloading = true;
$this->process->trigger_reload();
$this->clearWatch();
foreach ($this->dirs as $root) {
@@ -94,7 +90,6 @@ class Inotify
}
$this->process->int = -1;
$this->process->isReloading = FALSE;
$this->process->isReloadingOut = FALSE;
}
+3
View File
@@ -103,6 +103,9 @@ class Scaner
*/
public function timerReload()
{
if ($this->process->isReloading) {
return;
}
$this->process->isReloading = true;
$this->process->trigger_reload();