This commit is contained in:
2021-12-06 14:38:06 +08:00
parent f7a2d6f30e
commit b0ef09fd35
+6
View File
@@ -60,6 +60,7 @@ class HotReload extends Command
/** /**
* @throws ConfigException * @throws ConfigException
* @throws \ReflectionException * @throws \ReflectionException
* @throws Exception
*/ */
protected function initCore() protected function initCore()
{ {
@@ -70,6 +71,10 @@ class HotReload extends Command
} else { } else {
$this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]); $this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]);
} }
if (file_exists(storage('.manager.pid'))) {
Process::kill(file_get_contents((int)storage('.manager.pid')));
}
file_put_contents(storage('.manager.pid'), getmypid());
if (Kiri::getPlatform()->isLinux()) { if (Kiri::getPlatform()->isLinux()) {
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather'); swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
} }
@@ -124,6 +129,7 @@ class HotReload extends Command
if (!$data) { if (!$data) {
return; return;
} }
Timer::clearAll();
$this->driver->clear(); $this->driver->clear();
$this->stopServer(); $this->stopServer();
$this->stopManager(); $this->stopManager();