mirror of
https://github.com/SlavikMIPT/tgcloud.git
synced 2025-03-09 15:40:14 +00:00
flush() has been added to telegram_client_x.py
trying to read 1 byte from pipe if block is already uploaded
This commit is contained in:
parent
d194c27e0f
commit
89c4132b46
2 changed files with 15 additions and 8 deletions
|
@ -375,6 +375,8 @@ class TelegramClientX(TelegramClient):
|
|||
cdn_decrypter, result = CdnDecrypter.prepare_decrypter(client, self._get_cdn_client(result), result)
|
||||
else:
|
||||
f.write(result.bytes)
|
||||
if callable(getattr(f, 'flush', None)):
|
||||
f.flush()
|
||||
offset += part_size
|
||||
except FileMigrateError as e:
|
||||
__log__.info('File lives in another DC')
|
||||
|
@ -410,6 +412,8 @@ class TelegramClientX(TelegramClient):
|
|||
for th in download_thread:
|
||||
if th.result and th.result.bytes:
|
||||
f.write(th.result.bytes)
|
||||
if callable(getattr(f, 'flush', None)):
|
||||
f.flush()
|
||||
if progress_callback:
|
||||
progress_callback(f.tell(), file_size)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue