This commit is contained in:
2020-11-17 16:49:34 +08:00
parent 54ff4f29cc
commit 767f726512
+9 -6
View File
@@ -51,7 +51,7 @@ class ServerInotify extends Process
foreach ($this->dirs as $dir) {
$this->loadByDir($dir);
}
Timer::tick(2000, [$this, 'tick']);
Timer::after(2000, [$this, 'tick']);
}
}
@@ -67,6 +67,10 @@ class ServerInotify extends Process
foreach ($this->dirs as $dir) {
$this->loadByDir($dir, true);
}
if ($this->isReloading) {
return;
}
Timer::after(2000, [$this, 'tick']);
}
@@ -92,7 +96,6 @@ class ServerInotify extends Process
if (!isset($this->md5Map[$md5])) {
if ($isReload) {
$this->isReloading = true;
Timer::clearAll();
return Timer::after(2000, [$this, 'timerReload']);
}
$this->md5Map[$md5] = $mTime;
@@ -100,7 +103,6 @@ class ServerInotify extends Process
if ($this->md5Map[$md5] != $mTime) {
if ($isReload) {
$this->isReloading = true;
Timer::clearAll();
return Timer::after(2000, [$this, 'timerReload']);
}
$this->md5Map[$md5] = $mTime;
@@ -177,13 +179,14 @@ class ServerInotify extends Process
$this->isReloading = true;
$this->trigger_reload();
$this->int = -1;
$this->isReloading = FALSE;
$this->isReloadingOut = FALSE;
$this->md5Map = [];
$this->loadByDir(APP_PATH . 'app');
$this->loadByDir(APP_PATH . 'routes');
Timer::tick(2000, [$this, 'tick']);
$this->isReloading = FALSE;
$this->isReloadingOut = FALSE;
Timer::after(2000, [$this, 'tick']);
}
/**