优化插件初始化方式

This commit is contained in:
cool 2024-03-04 15:21:42 +08:00
parent c6e660713b
commit 66a21e97b2
2 changed files with 8 additions and 2 deletions

View File

@ -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();
}
}

View File

@ -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;