try run server and client in same task

This commit is contained in:
HgO 2022-07-09 12:25:10 +02:00
parent bc3f6ac452
commit f5394c142f

View file

@ -52,7 +52,7 @@ def create_matrix_client(config: Config) -> AsyncClient:
async def start_matrix_client(
client: AsyncClient, cache: Cache, config: Config
client: AsyncClient, webhook_server: Webhook, cache: Cache, config: Config
) -> bool:
# Keep trying to reconnect on failure (with some time in-between)
while True:
@ -134,8 +134,8 @@ def main() -> None:
webhook_server = Webhook(client, cache, config)
loop = asyncio.get_event_loop()
loop.create_task(webhook_server.start())
loop.create_task(start_matrix_client(client, cache, config))
# loop.create_task(webhook_server.start())
loop.create_task(start_matrix_client(client, webhook_server, cache, config))
try:
loop.run_forever()