fix(backend): disableClustering設定時の初期化ロジックを調整 (#15224)

* fix(backend): disableClustering設定時の初期化ロジックを調整

* onlyServer かつ enableCluster な場合、メインプロセスでlistenするとワーカープロセス側のlistenと衝突するため、メインプロセスはforkのみに制限する(listenしない)

* ログの追加

* fix CHANGELOG.md

* fix comment
This commit is contained in:
おさむのひと
2025-01-07 21:19:59 +09:00
committed by GitHub
parent 6c9eea2c0f
commit 8ad97e5ede
3 changed files with 36 additions and 18 deletions

View File

@@ -68,16 +68,22 @@ process.on('exit', code => {
//#endregion
if (cluster.isPrimary || envOption.disableClustering) {
await masterMain();
if (!envOption.disableClustering) {
if (cluster.isPrimary) {
logger.info(`Start main process... pid: ${process.pid}`);
await masterMain();
ev.mount();
} else if (cluster.isWorker) {
logger.info(`Start worker process... pid: ${process.pid}`);
await workerMain();
} else {
throw new Error('Unknown process type');
}
}
if (cluster.isWorker || envOption.disableClustering) {
await workerMain();
} else {
// 非clusterの場合はMasterのみが起動するため、Workerの処理は行わない(cluster.isWorker === trueの状態でこのブロックに来ることはない)
logger.info(`Start main process... pid: ${process.pid}`);
await masterMain();
ev.mount();
}
readyRef.value = true;