mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-03 11:40:11 +03:00
Fix sleeps
This commit is contained in:
parent
25b220b4bd
commit
e1f8807d83
|
@ -242,8 +242,8 @@ class MessageMethods(UploadMethods, MessageParseMethods):
|
|||
else:
|
||||
request.max_date = last_message.date
|
||||
|
||||
asyncio.sleep(
|
||||
max(wait_time - (time.time() - start), 0), loop=self._loop)
|
||||
time.sleep(
|
||||
max(wait_time - (time.time() - start), 0))
|
||||
|
||||
def get_messages(self, *args, **kwargs):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import asyncio
|
||||
import inspect
|
||||
import concurrent.futures
|
||||
import itertools
|
||||
import logging
|
||||
import random
|
||||
|
@ -188,11 +187,9 @@ class UpdateMethods(UserMethods):
|
|||
rnd = lambda: random.randrange(-2**63, 2**63)
|
||||
while self.is_connected():
|
||||
try:
|
||||
asyncio.wait_for(
|
||||
self.disconnected, timeout=60, loop=self._loop
|
||||
)
|
||||
concurrent.futures.wait([self.disconnected], timeout=60)
|
||||
continue # We actually just want to act upon timeout
|
||||
except asyncio.TimeoutError:
|
||||
except concurrent.futures.TimeoutError:
|
||||
pass
|
||||
except:
|
||||
continue # Any disconnected exception should be ignored
|
||||
|
|
|
@ -39,7 +39,7 @@ class UserMethods(TelegramBaseClient):
|
|||
except (errors.FloodWaitError, errors.FloodTestPhoneWaitError) as e:
|
||||
if e.seconds <= self.flood_sleep_threshold:
|
||||
__log__.info('Sleeping for %ds on flood wait', e.seconds)
|
||||
asyncio.sleep(e.seconds, loop=self._loop)
|
||||
time.sleep(e.seconds)
|
||||
else:
|
||||
raise
|
||||
except (errors.PhoneMigrateError, errors.NetworkMigrateError,
|
||||
|
|
Loading…
Reference in New Issue
Block a user