Support async progress_callback in upload_file (#1259)

This commit is contained in:
painor
2019-08-19 21:11:13 +02:00
committed by Lonami
parent 42874de2b2
commit bd7ab23a8f
+3 -1
View File
@@ -573,7 +573,9 @@ class UploadMethods:
self._log[__name__].debug('Uploaded %d/%d',
part_index + 1, part_count)
if progress_callback:
progress_callback(stream.tell(), file_size)
r = progress_callback(stream.tell(), file_size)
if inspect.isawaitable(r):
await r
else:
raise RuntimeError(
'Failed to upload file part {}.'.format(part_index))