fix: a resumed download is not counted as speed

The live line divided every byte by the run's time, a partial copy left by an earlier run included, and showed a 3 GB resume as 2.5 GB/s with nothing left.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 04:40:52 +02:00
1 parent cf9406ab67
commit 9e8229c07a
4 files changed
+31 -3

No files matched your search

+3 -1
View File
@@ -347,7 +347,9 @@ class Progress:
def _draw(self) -> None:
share = min(self.bytes / self.total_bytes, 1.0)
elapsed = self.elapsed()
speed = self.bytes / elapsed if elapsed > 0 else 0
# A resumed partial copy was on disk before the run started: counted
# in the share, never in the speed.
speed = self.transferred() / elapsed if elapsed > 0 else 0
left = (self.total_bytes - self.bytes) / speed if speed > 0 else 0
parts = [
f"{share * 100:5.1f}%",