Skip to content

Commit

Permalink
Retry on 429 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Jan 9, 2024
1 parent 17bbcea commit d70ea40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.2 (unreleased)

- Retry on 429 HTTP responses

## 0.1.1

- Add option to set default maximum waiting time for async operations and override ip per request
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (client *Client) Do(req Req) (Res, error) {
log.Printf("[ERROR] HTTP Request failed: StatusCode %v", httpRes.StatusCode)
log.Printf("[DEBUG] Exit from Do method")
return res, fmt.Errorf("HTTP Request failed: StatusCode %v", httpRes.StatusCode)
} else if httpRes.StatusCode == 408 || (httpRes.StatusCode >= 502 && httpRes.StatusCode <= 504) {
} else if httpRes.StatusCode == 408 || httpRes.StatusCode == 429 || (httpRes.StatusCode >= 502 && httpRes.StatusCode <= 504) {
log.Printf("[ERROR] HTTP Request failed: StatusCode %v, Retries: %v", httpRes.StatusCode, attempts)
continue
} else {
Expand Down

0 comments on commit d70ea40

Please sign in to comment.