mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Except ServerErrors and sleep a bit before retrying
This commit is contained in:
parent
76e5206acc
commit
c9dff552b8
|
@ -10,7 +10,7 @@ from time import sleep
|
|||
from . import helpers as utils
|
||||
from .crypto import rsa, CdnDecrypter
|
||||
from .errors import (
|
||||
RPCError, BrokenAuthKeyError,
|
||||
RPCError, BrokenAuthKeyError, ServerError,
|
||||
FloodWaitError, FileMigrateError, TypeNotFoundError,
|
||||
UnauthorizedError, PhoneMigrateError, NetworkMigrateError, UserMigrateError
|
||||
)
|
||||
|
@ -496,6 +496,13 @@ class TelegramBareClient:
|
|||
while self._user_connected and not self._reconnect():
|
||||
sleep(0.1) # Retry forever until we can send the request
|
||||
|
||||
except ServerError as e:
|
||||
# Telegram is having some issues, sleep a tiny bit and retry
|
||||
self._logger.debug(
|
||||
'[ERROR] Telegram is having some internal issues', e
|
||||
)
|
||||
sleep(2)
|
||||
|
||||
except FloodWaitError:
|
||||
sender.disconnect()
|
||||
self.disconnect()
|
||||
|
|
Loading…
Reference in New Issue
Block a user