-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP retry mechanism #256
Conversation
Bazelisk now retries failing HTTP requests whose status code indicates that a retry makes sense (e.g. 429, 503). It considers a variety of HTTP headers (such as Retry-After, X-RateLimit-Reset, Rate-Limit-Reset) in order to determine when to retry. If no such header is present Bazelisk employs an exponential backoff retry strategy (with some randomness). Fixes bazelbuild#254
httputil/httputil.go
Outdated
// ReadRemoteFile returns the contents of the given file, using the supplied Authorization token, if set. It also returns the HTTP headers. | ||
// If the request fails with a transient error it will retry the request for at most MaxRetries times. | ||
// It obeys HTTP headers such as "Retry-After" when calculating the start time of the next attempt. If no such header is present, it uses an exponential backoff strategy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: line-break after "... of the next attempt."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, nice!
Bazelisk now retries failing HTTP requests whose status code indicates that a retry makes sense (e.g. 429, 503).
It considers a variety of HTTP headers (such as Retry-After, X-RateLimit-Reset, Rate-Limit-Reset) in order to determine when to retry.
If no such header is present Bazelisk employs an exponential backoff retry strategy (with some randomness).
Fixes #254