feat(restapi): retry on 500s, 503s, 504s as well as 502s (#1586)

This commit is contained in:
patrickxia
2025-11-16 10:23:28 -05:00
committed by GitHub
parent 18d25918de
commit dd9332c711

View File

@@ -267,6 +267,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 {
@@ -276,7 +282,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 {