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
ProgressDisplayclass by adding aresumed_atattribute to keep track of the progress that has already been done. - Change the
ProgressDisplay.stop()method to passtask.completed - self.resumed_atinstead oftask.completed
Related
Solves the issue #1516
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 94.26%. Comparing base (
4d7d6b6) to head (939e774). Report is 372 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #1518 +/- ##
==========================================
- Coverage 97.28% 94.26% -3.02%
==========================================
Files 67 113 +46
Lines 4235 7696 +3461
==========================================
+ Hits 4120 7255 +3135
- Misses 115 441 +326
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.