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 platform
import time import time
from telethon.errors import UnauthorizedError
from telethon.network import ( from telethon.network import (
Connection, Connection,
ConnectionTcpFull, ConnectionTcpFull,
@@ -238,6 +239,9 @@ class AbstractUser(ABC):
self.log.critical(f"Stopping due to update handling error {type(err).__name__}") self.log.critical(f"Stopping due to update handling error {type(err).__name__}")
self.bridge.manual_stop(50) self.bridge.manual_stop(50)
else: else:
if isinstance(err, UnauthorizedError):
self.log.warning("Not recreating Telethon update loop")
return
self.log.info("Recreating Telethon update loop in 60 seconds") self.log.info("Recreating Telethon update loop in 60 seconds")
await asyncio.sleep(60) await asyncio.sleep(60)
self.log.debug("Now recreating Telethon update loop") self.log.debug("Now recreating Telethon update loop")