From 66a21e97b21b38717897e4dfdad1d5713054fbb0 Mon Sep 17 00:00:00 2001 From: cool Date: Mon, 4 Mar 2024 15:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=92=E4=BB=B6=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/plugin/event/app.ts | 5 ++++- src/modules/plugin/service/center.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/plugin/event/app.ts b/src/modules/plugin/event/app.ts index cb2a2c5..91fd746 100644 --- a/src/modules/plugin/event/app.ts +++ b/src/modules/plugin/event/app.ts @@ -21,9 +21,12 @@ export class BaseAppEvent { @Inject() cacheManager: CacheManager; + @Inject() + pluginCenterService: PluginCenterService; + @Event('onServerReady') async onServerReady() { await this.cacheManager.set(PLUGIN_CACHE_KEY, []); - this.app.getApplicationContext().getAsync(PluginCenterService); + this.pluginCenterService.init(); } } diff --git a/src/modules/plugin/service/center.ts b/src/modules/plugin/service/center.ts index 0142005..68a8003 100644 --- a/src/modules/plugin/service/center.ts +++ b/src/modules/plugin/service/center.ts @@ -45,7 +45,10 @@ export class PluginCenterService { @Inject() coolEventManager: CoolEventManager; - @Init() + /** + * 初始化 + * @returns + */ async init() { const inits: any[] = (await this.cacheManager.get(PLUGIN_CACHE_KEY)) || []; const pid = process.pid;