mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 03:13:45 +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 . import helpers as utils
|
||||||
from .crypto import rsa, CdnDecrypter
|
from .crypto import rsa, CdnDecrypter
|
||||||
from .errors import (
|
from .errors import (
|
||||||
RPCError, BrokenAuthKeyError,
|
RPCError, BrokenAuthKeyError, ServerError,
|
||||||
FloodWaitError, FileMigrateError, TypeNotFoundError,
|
FloodWaitError, FileMigrateError, TypeNotFoundError,
|
||||||
UnauthorizedError, PhoneMigrateError, NetworkMigrateError, UserMigrateError
|
UnauthorizedError, PhoneMigrateError, NetworkMigrateError, UserMigrateError
|
||||||
)
|
)
|
||||||
|
@ -496,6 +496,13 @@ class TelegramBareClient:
|
||||||
while self._user_connected and not self._reconnect():
|
while self._user_connected and not self._reconnect():
|
||||||
sleep(0.1) # Retry forever until we can send the request
|
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:
|
except FloodWaitError:
|
||||||
sender.disconnect()
|
sender.disconnect()
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user