Compare commits

..

2 Commits

Author SHA1 Message Date
as2252258 3ca39d2205 eee 2026-07-03 14:25:26 +08:00
as2252258 908c8719d3 eee 2026-06-24 20:17:54 +08:00
+21 -17
View File
@@ -125,22 +125,26 @@ class ServerCommand extends Command
} }
/** /**
* @param InputInterface $input * @param InputInterface $input
* @return int * @return int
* @throws * @throws
*/ */
protected function start(InputInterface $input): int protected function start(InputInterface $input): int
{ {
$this->asyncServer->addProcess(config('process', [])); $this->asyncServer->addProcess(config('process', []));
if (\config('servers.reload.hot', false) === true) { $hotReload = \config('servers.reload.hot', false) === true;
$this->asyncServer->addProcess([FileWatcher::class]); if ($hotReload) {
} else { $this->asyncServer->addProcess([FileWatcher::class]);
di(Router::class)->scan_build_route(); }
} if (!$hotReload) {
$this->asyncServer->initCoreServers(config('servers.server', []), (int)$input->getOption('daemon')); // 非热更模式可在 Master 进程预扫描,Worker 通过 fork 继承扫描结果。
$this->asyncServer->start(); // 热更模式必须让新 Worker 自己加载业务类,避免继承旧类定义后无法重新声明。
return 1; di(Router::class)->scan_build_route();
} }
$this->asyncServer->initCoreServers(config('servers.server', []), (int)$input->getOption('daemon'));
$this->asyncServer->start();
return 1;
}
} }