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;