Don't recreate update loop on UnauthorizedErrors

This commit is contained in:
Tulir Asokan
2022-09-20 00:26:42 +03:00
parent ed1e5474bf
commit e0260eb551
+4
View File
@@ -22,6 +22,7 @@ import logging
import platform
import time
from telethon.errors import UnauthorizedError
from telethon.network import (
Connection,
ConnectionTcpFull,
@@ -238,6 +239,9 @@ class AbstractUser(ABC):
self.log.critical(f"Stopping due to update handling error {type(err).__name__}")
self.bridge.manual_stop(50)
else:
if isinstance(err, UnauthorizedError):
self.log.warning("Not recreating Telethon update loop")
return
self.log.info("Recreating Telethon update loop in 60 seconds")
await asyncio.sleep(60)
self.log.debug("Now recreating Telethon update loop")