cli
cli copied to clipboard
Fix average download speed (httpie#1516)
Problem
When DownloadStatus
is finished, it calls ProgressDisplay.stop()
, which in turn calls ProgressDisplay._print_summary()
Here, in _print_summary()
, we incorrectly assume that task.completed
means observed steps, but in fact, when the download finishes, it is equal to task.total
, which leads to issue with incorrect average download speed - no matter where we resume the download process, we always get task.total
steps
Solution
- Extend the
ProgressDisplay
class by adding aresumed_at
attribute to keep track of the progress that has already been done. - Change the
ProgressDisplay.stop()
method to passtask.completed - self.resumed_at
instead oftask.completed
Related
Solves the issue #1516