MC
Size: a a a
MC
AS
MC
MC
AS
MC
MC
AS
K0
from datetime import datetime as dt
from contextlib import suppress
before = dt.now()
with suppress(Exception):
async for m in client.iter_messages(event.chat_id):
pass
diff = dt.now() - before
print(diff)
0:02:46.578444
K0
K0
K0
ms = await client.get_messages(event.chat_id, limit=0)
print(ms.total)
15362
NK
iter_messages
NK
client.session.flood_sleep_threshold = 0
while True:
print('running at', time())
try:
run
n += 1
except FloodWaitError as e:
print('fail at', time(), 'for', e.seconds, 'ran', n, 'ok')
n = 0
break
NK
workers = [self.iter_download(
input_location,
offset=i * chunk_size,
stride=num_workers * chunk_size,
request_size=chunk_size
) for i in range(num_workers)]
finished = False
while not finished:
done, pending = await asyncio.wait([worker.__anext__() for worker in workers])
for task in done:
chunk = task.result()
f.write(chunk)
finished = len(chunk) < chunk_size
NK
async for chunk in client.iter_download(...)
NK
NK
K0
iter_messages
NK