Skip to content

http: use Retry-After HTTP header to optimize retries

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

Loading