I'm setting workers count to 4 (in Pyrogram client) to download multiple files at the same time, It is creating all the temporary files at first, but downloading one file at a time.
I'm downloading profile photos actually.
Github issue:
https://github.com/pyrogram/pyrogram/issues/83
My problem is not related to python. in the python side, downloads are running in parallel and I've confirmed this. The problem is related to Pyrogram library.
my code:
photos = await generator_to_list2(client.get_chat_photos(chat_member.user.id))
photos: list[pyrogram.types.Photo]
tasks = []
for index, photo in enumerate(photos):
tasks.append(asyncio.create_task(
client.download_media(
message=photo.file_id,
file_name=f'{path}/files/photos/{index}.jpg'
)
))
await asyncio.gather(*tasks)
print('fully done!')