Correct ETA after resume

This commit is contained in:
8street 2025-01-06 16:19:08 +03:00
parent e43bc2bb01
commit d3feb430ef

View File

@ -62,6 +62,10 @@ class DownloadContext(dict):
ctx.is_resume = ctx.resume_len > 0
ctx.start_len = 0
if ctx.is_resume:
ctx.start_len = ctx.resume_len
class SucceedDownload(Exception):
pass
@ -300,7 +304,7 @@ def retry(e):
if ctx.data_len is None:
eta = None
else:
eta = self.calc_eta(ctx.start_time, time.time(), ctx.data_len, byte_counter)
eta = self.calc_eta(ctx.start_time, time.time(), ctx.data_len - ctx.start_len, byte_counter - ctx.start_len)
self._hook_progress({
'status': 'downloading',