mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-02 03:00:15 +03:00
commit fixes
This commit is contained in:
parent
4041f417f4
commit
fdde26551b
|
@ -102,12 +102,11 @@ def retry_range(retries, force_retry=True):
|
|||
infinite, otherwise it will end at `retries + 1`.
|
||||
"""
|
||||
|
||||
# We need atleast one iteration even if the retries are 0
|
||||
# We need at least one iteration even if the retries are 0
|
||||
# when force_retry is True.
|
||||
if retries == 0 and force_retry:
|
||||
yield 1
|
||||
if force_retry:
|
||||
retries+=1
|
||||
|
||||
# If retries are non 0 then iterate
|
||||
attempt = 0
|
||||
while attempt != retries:
|
||||
attempt += 1
|
||||
|
|
|
@ -360,7 +360,8 @@ class MTProtoSender:
|
|||
retries = self._retries if self._auto_reconnect else 0
|
||||
|
||||
attempt = 0
|
||||
for attempt in retry_range(retries, False):
|
||||
# We're already "retrying" to connect, so we don't want to force retries
|
||||
for attempt in retry_range(retries, force_retry=False):
|
||||
try:
|
||||
await self._connect()
|
||||
except (IOError, asyncio.TimeoutError) as e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user