From 529d8ae3ba78700307d4d931a99078ca707c6fea Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 27 Jan 2023 14:57:47 +0200 Subject: [PATCH] Recreate whole connection instead of only update loop on error --- mautrix_telegram/abstract_user.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mautrix_telegram/abstract_user.py b/mautrix_telegram/abstract_user.py index 37fa4474..7ef1c150 100644 --- a/mautrix_telegram/abstract_user.py +++ b/mautrix_telegram/abstract_user.py @@ -247,10 +247,11 @@ class AbstractUser(ABC): self.log.critical(f"Stopping due to update handling error {type(err).__name__}") self.bridge.manual_stop(50) else: - self.log.info("Recreating Telethon update loop in 60 seconds") + self.log.info("Recreating Telethon connection in 60 seconds") await asyncio.sleep(60) - self.log.debug("Now recreating Telethon update loop") - self.client._updates_handle = self.loop.create_task(self.client._update_loop()) + self.log.debug("Now recreating Telethon connection") + await self.stop() + await self.start() @abstractmethod async def update(self, update: TypeUpdate) -> bool: