From bb52aea4068c3e86b545c822a93b140dfe3f85b9 Mon Sep 17 00:00:00 2001 From: COOL Date: Fri, 20 Jun 2025 11:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20onServerReadyOnce=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8CCluster=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=E4=B9=9F=E5=8F=AA=E8=A7=A6=E5=8F=91=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/package.json | 2 +- core/src/configuration.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/package.json b/core/package.json index d5939fa..c03c0fa 100644 --- a/core/package.json +++ b/core/package.json @@ -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", diff --git a/core/src/configuration.ts b/core/src/configuration.ts index 4f78b39..8336051 100644 --- a/core/src/configuration.ts +++ b/core/src/configuration.ts @@ -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); + } } }