perf: 完善插件加载流程

This commit is contained in:
RockChinQ
2024-01-29 21:41:20 +08:00
parent c75b0ce8fb
commit 13ab647dc0
4 changed files with 29 additions and 18 deletions

View File

@@ -67,6 +67,7 @@ class Application:
async def run(self):
await self.plugin_mgr.load_plugins()
await self.plugin_mgr.initialize_plugins()
tasks = [
asyncio.create_task(self.im_mgr.run()),

View File

@@ -92,6 +92,10 @@ async def make_app() -> app.Application:
await ver_mgr.initialize()
ap.ver_mgr = ver_mgr
plugin_mgr_inst = plugin_mgr.PluginManager(ap)
await plugin_mgr_inst.initialize()
ap.plugin_mgr = plugin_mgr_inst
center_v2_api = center_v2.V2CenterAPI(
ap,
basic_info={
@@ -137,11 +141,6 @@ async def make_app() -> app.Application:
ctrl = controller.Controller(ap)
ap.ctrl = ctrl
# TODO make it async
plugin_mgr_inst = plugin_mgr.PluginManager(ap)
await plugin_mgr_inst.initialize()
ap.plugin_mgr = plugin_mgr_inst
await ap.initialize()