mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Support asynchronous progress_callback's
This commit is contained in:
parent
3f19f6fd50
commit
0d9e639f4f
|
@ -3,6 +3,7 @@ import io
|
|||
import os
|
||||
import pathlib
|
||||
import typing
|
||||
import inspect
|
||||
|
||||
from .. import utils, helpers, errors, hints
|
||||
from ..requestiter import RequestIter
|
||||
|
@ -434,7 +435,9 @@ class DownloadMethods:
|
|||
input_location, request_size=part_size, dc_id=dc_id):
|
||||
f.write(chunk)
|
||||
if progress_callback:
|
||||
progress_callback(f.tell(), file_size)
|
||||
r = progress_callback(f.tell(), file_size)
|
||||
if inspect.isawaitable(r):
|
||||
await r
|
||||
|
||||
f.flush()
|
||||
if in_memory:
|
||||
|
|
Loading…
Reference in New Issue
Block a user