Skip to content
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

restapi: retry on 500/503/504 as well as 502 #1586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
case http.StatusOK:
case http.StatusCreated:
case http.StatusNoContent:
case http.StatusInternalServerError:
fallthrough
case http.StatusServiceUnavailable:
fallthrough
case http.StatusGatewayTimeout:
fallthrough
case http.StatusBadGateway:
// Retry sending request if possible
if sequence < cfg.MaxRestRetries {
Expand All @@ -275,7 +281,7 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
} else {
err = fmt.Errorf("Exceeded Max retries HTTP %s, %s", resp.Status, response)
}
case 429: // TOO MANY REQUESTS - Rate limiting
case http.StatusTooManyRequests:
rl := TooManyRequests{}
err = Unmarshal(response, &rl)
if err != nil {
Expand Down