Skip to content

Fix average download speed (httpie#1516)#1518

Closed
mikurei wants to merge 1 commit intohttpie:masterfrom
mikurei:fix_avg_download_speed
Closed

Fix average download speed (httpie#1516)#1518
mikurei wants to merge 1 commit intohttpie:masterfrom
mikurei:fix_avg_download_speed

Conversation

@mikurei
Copy link
Copy Markdown

@mikurei mikurei commented Jul 14, 2023

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 20, 2024

⚠️ 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.
✅ Project coverage is 94.26%. Comparing base (4d7d6b6) to head (939e774).
⚠️ Report is 383 commits behind head on master.
❗ 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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mikurei mikurei closed this by deleting the head repository Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants