diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index f58d3ceb..5181b029 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1447,11 +1447,13 @@ class Client(Methods, BaseClient): file_total_parts = int(math.ceil(file_size / part_size)) is_big = file_size > 10 * 1024 * 1024 + pool_size = 3 if is_big else 1 + workers_count = 4 if is_big else 1 is_missing_part = file_id is not None file_id = file_id or self.rnd_id() md5_sum = md5() if not is_big and not is_missing_part else None - pool = [Session(self, self.dc_id, self.auth_key, is_media=True) for _ in range(3)] - workers = [asyncio.ensure_future(worker(session)) for session in pool for _ in range(4)] + pool = [Session(self, self.dc_id, self.auth_key, is_media=True) for _ in range(pool_size)] + workers = [asyncio.ensure_future(worker(session)) for session in pool for _ in range(workers_count)] queue = asyncio.Queue(16) try: