From 6292fe8f86cd3af6bc1ce0ab7b74a9be19d1fe34 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 11:24:31 +0100 Subject: [PATCH] Fix progress callbacks in asyncio --- pyrogram/client/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 924c5df7..3c0081a7 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1202,7 +1202,7 @@ class Client(Methods, BaseClient): file_part += 1 if progress: - progress(self, min(file_part * part_size, file_size), file_size, *progress_args) + await progress(self, min(file_part * part_size, file_size), file_size, *progress_args) except Exception as e: log.error(e, exc_info=True) else: @@ -1321,7 +1321,7 @@ class Client(Methods, BaseClient): offset += limit if progress: - progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) + await progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) r = await session.send( functions.upload.GetFile( @@ -1403,7 +1403,7 @@ class Client(Methods, BaseClient): offset += limit if progress: - progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) + await progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) if len(chunk) < limit: break