Skip to content
Snippets Groups Projects

http: use Retry-After HTTP header to optimize retries

Merged Felix Moessbauer requested to merge fmoessbauer/apt:fm/apt-rate-limit into main

Some mirrors like snapshot.debian.org apply strict http rate limits. While apt already has an exponential backoff mechanism implemented, this is not sufficient due to the following reasons:

  1. all retries happen roughly at the same time
  2. the retry-after information from the server is not used

We fix this by improving the algorithm: First, if present, the timestamp or duration of the Retry-After header is added to the exponential backoff, optimizing for success-on-second-try. Second, a random delay is added (delay += [0, delay]) to distribute the retries to not immediately run into the limit again. To avoid super-long delays, this is capped by the configured maximum delay.

Signed-off-by: Felix Moessbauer felix.moessbauer@siemens.com

Merge request reports

Pipeline #764989 passed

Pipeline passed for cabcaf3c on fmoessbauer:fm/apt-rate-limit

Approval is optional
Ready to merge by members who can write to the target branch.

Merge details

  • 3 commits and 1 merge commit will be added to master.
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading