Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,7 @@ func DefaultBackoff(min, max time.Duration, attemptNum int, resp *http.Response)
if resp != nil {
if resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusServiceUnavailable {
if sleep, ok := parseRetryAfterHeader(resp.Header["Retry-After"]); ok {
if sleep <= max {
return sleep
}
return sleep
}
}
}
Expand Down Expand Up @@ -754,6 +752,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
}

wait := c.Backoff(c.RetryWaitMin, c.RetryWaitMax, i, resp)
if wait > c.RetryWaitMax { // If the server wants us to wait longer than we are allowed, give up.
break
}
if logger != nil {
desc := fmt.Sprintf("%s %s", req.Method, redactURL(req.URL))
if resp != nil {
Expand Down