From ef6125b57ad22aa2aff83365216b6e90970f54df Mon Sep 17 00:00:00 2001 From: AduchiMergen Date: Tue, 21 Dec 2021 02:22:56 +0700 Subject: [PATCH] Fix -503 Timeout errors #664 (#812) --- pyrogram/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index b54794fa..61722ac3 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -916,9 +916,6 @@ class Client(Methods, Scaffold): while True: chunk = r.bytes - if not chunk: - break - f.write(chunk) offset += limit @@ -938,6 +935,9 @@ class Client(Methods, Scaffold): else: await self.loop.run_in_executor(self.executor, func) + if len(chunk) < limit: + break + r = await session.send( raw.functions.upload.GetFile( location=location,