mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Add a retry mechanism when uploading chunks
This commit is contained in:
parent
a2263ad8ce
commit
712b390f77
1 changed files with 18 additions and 14 deletions
|
|
@ -1439,21 +1439,25 @@ class Client(Methods, BaseClient):
|
||||||
md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()])
|
md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()])
|
||||||
break
|
break
|
||||||
|
|
||||||
if is_big:
|
for _ in range(3):
|
||||||
rpc = functions.upload.SaveBigFilePart(
|
if is_big:
|
||||||
file_id=file_id,
|
rpc = functions.upload.SaveBigFilePart(
|
||||||
file_part=file_part,
|
file_id=file_id,
|
||||||
file_total_parts=file_total_parts,
|
file_part=file_part,
|
||||||
bytes=chunk
|
file_total_parts=file_total_parts,
|
||||||
)
|
bytes=chunk
|
||||||
else:
|
)
|
||||||
rpc = functions.upload.SaveFilePart(
|
else:
|
||||||
file_id=file_id,
|
rpc = functions.upload.SaveFilePart(
|
||||||
file_part=file_part,
|
file_id=file_id,
|
||||||
bytes=chunk
|
file_part=file_part,
|
||||||
)
|
bytes=chunk
|
||||||
|
)
|
||||||
|
|
||||||
assert session.send(rpc), "Couldn't upload file"
|
if session.send(rpc):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise AssertionError("Telegram didn't accept chunk #{} of {}".format(file_part, path))
|
||||||
|
|
||||||
if is_missing_part:
|
if is_missing_part:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue