cli icon indicating copy to clipboard operation
cli copied to clipboard

Fix average download speed (httpie#1516)

Open mikurei opened this issue 2 years ago • 1 comments

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 a resumed_at attribute to keep track of the progress that has already been done.
  • Change the ProgressDisplay.stop() method to pass task.completed - self.resumed_at instead of task.completed

Related

Solves the issue #1516

mikurei avatar Jul 14 '23 22:07 mikurei

:warning: Please install the 'codecov app svg image' 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.

codecov-commenter avatar Aug 20 '24 21:08 codecov-commenter