mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
优化插件初始化方式
This commit is contained in:
parent
c6e660713b
commit
66a21e97b2
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user