mirror of
https://github.com/maubot/maubot
synced 2025-08-30 14:30:38 +00:00
Refactor how plugins are started and update spec
This commit is contained in:
parent
b96d6e6a94
commit
9e066478a9
10 changed files with 160 additions and 79 deletions
|
@ -57,7 +57,7 @@ Base.metadata.create_all()
|
|||
loop = asyncio.get_event_loop()
|
||||
|
||||
init_db(db_session)
|
||||
init_client(loop)
|
||||
clients = init_client(loop)
|
||||
init_plugin_instance_class(db_session, config)
|
||||
management_api = init_management(config, loop)
|
||||
server = MaubotServer(config, management_api, loop)
|
||||
|
@ -84,9 +84,10 @@ async def periodic_commit():
|
|||
|
||||
|
||||
try:
|
||||
loop.run_until_complete(asyncio.gather(
|
||||
server.start(),
|
||||
*[plugin.start() for plugin in plugins]))
|
||||
log.debug("Starting server")
|
||||
loop.run_until_complete(server.start())
|
||||
log.debug("Starting clients and plugins")
|
||||
loop.run_until_complete(asyncio.gather(*[client.start() for client in clients]))
|
||||
log.debug("Startup actions complete, running forever")
|
||||
loop.run_until_complete(periodic_commit())
|
||||
loop.run_forever()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue