eee
This commit is contained in:
+7
-4
@@ -133,12 +133,15 @@ class ServerCommand extends Command
|
|||||||
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;
|
||||||
|
if ($hotReload) {
|
||||||
$this->asyncServer->addProcess([FileWatcher::class]);
|
$this->asyncServer->addProcess([FileWatcher::class]);
|
||||||
}
|
}
|
||||||
// Master 进程在 fork 前完成首次扫描,Worker 启动时不再重复全量扫描
|
if (!$hotReload) {
|
||||||
// 避免每个 Worker 独立执行 opcache_compile_file + invalidateClasses 造成 OOM
|
// 非热更模式可在 Master 进程预扫描,Worker 通过 fork 继承扫描结果。
|
||||||
di(Router::class)->scan_build_route();
|
// 热更模式必须让新 Worker 自己加载业务类,避免继承旧类定义后无法重新声明。
|
||||||
|
di(Router::class)->scan_build_route();
|
||||||
|
}
|
||||||
$this->asyncServer->initCoreServers(config('servers.server', []), (int)$input->getOption('daemon'));
|
$this->asyncServer->initCoreServers(config('servers.server', []), (int)$input->getOption('daemon'));
|
||||||
$this->asyncServer->start();
|
$this->asyncServer->start();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user