新增 onServerReadyOnce 事件,Cluster模式下也只触发一次

This commit is contained in:
COOL 2025-06-20 11:29:38 +08:00
parent 61e613bd4a
commit bb52aea406
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@cool-midway/core",
"version": "8.0.5",
"version": "8.0.6",
"description": "cool-admin midway core",
"main": "dist/index.js",
"typings": "index.d.ts",

View File

@ -87,8 +87,17 @@ export class CoolConfiguration implements ILifeCycle {
// 实体与路径
const eps: CoolEps = await container.getAsync(CoolEps);
eps.init();
}
/**
*
*/
async eventInit() {
this.coolEventManager.emit('onServerReady');
this.coolEventManager.globalEmit('onServerReadyOnce', true);
// location.clean();
const env = this.app.getEnv();
const isMainProcess = process.env.NODE_APP_INSTANCE == '0';
if (env == 'local' || isMainProcess) {
this.coolEventManager.globalEmit('onServerReadyOnce', true);
}
}
}