This commit is contained in:
2020-11-11 15:20:30 +08:00
parent 4840076366
commit 559ae6647e
+19 -4
View File
@@ -92,14 +92,16 @@ class ServerInotify extends Process
if (!isset($this->md5Map[$md5])) { if (!isset($this->md5Map[$md5])) {
if ($isReload) { if ($isReload) {
$this->isReloading = true; $this->isReloading = true;
return Timer::after(2000, [$this, 'reload']); Timer::clearAll();
return Timer::after(2000, [$this, 'timerReload']);
} }
$this->md5Map[$md5] = $mTime; $this->md5Map[$md5] = $mTime;
} else { } else {
if ($this->md5Map[$md5] != $mTime) { if ($this->md5Map[$md5] != $mTime) {
if ($isReload) { if ($isReload) {
$this->isReloading = true; $this->isReloading = true;
return Timer::after(2000, [$this, 'reload']); Timer::clearAll();
return Timer::after(2000, [$this, 'timerReload']);
} }
$this->md5Map[$md5] = $mTime; $this->md5Map[$md5] = $mTime;
} }
@@ -165,10 +167,23 @@ class ServerInotify extends Process
$this->isReloading = FALSE; $this->isReloading = FALSE;
$this->isReloadingOut = FALSE; $this->isReloadingOut = FALSE;
$this->md5Map = []; $this->md5Map = [];
if (Snowflake::isMac()) { }
/**
* @throws Exception
*/
public function timerReload()
{
$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 . 'app');
$this->loadByDir(APP_PATH . 'routes'); $this->loadByDir(APP_PATH . 'routes');
}
Timer::tick(2000, [$this, 'tick']);
} }
/** /**