This commit is contained in:
2020-09-03 01:37:02 +08:00
parent 132cdbad15
commit f80ec2eb9d
+7
View File
@@ -76,6 +76,9 @@ class ServerInotify extends Process
private function loadByDir($path, $isReload = false) private function loadByDir($path, $isReload = false)
{ {
$path = rtrim($path, '/'); $path = rtrim($path, '/');
if ($this->isReloading) {
return;
}
foreach (glob($path . '/*') as $value) { foreach (glob($path . '/*') as $value) {
if (is_dir($value)) { if (is_dir($value)) {
$this->loadByDir($value, $isReload); $this->loadByDir($value, $isReload);
@@ -148,6 +151,8 @@ class ServerInotify extends Process
*/ */
public function reload() public function reload()
{ {
$this->isReloading = true;
//清理所有监听 //清理所有监听
$this->trigger_reload(); $this->trigger_reload();
$this->clearWatch(); $this->clearWatch();
@@ -160,6 +165,8 @@ class ServerInotify extends Process
$this->int = -1; $this->int = -1;
$this->isReloading = FALSE; $this->isReloading = FALSE;
$this->isReloadingOut = FALSE; $this->isReloadingOut = FALSE;
$this->loadByDir(APP_PATH . 'app');
} }
/** /**