Skip to content

Commit

Permalink
feat: retry on 408 Request Timeout (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Sep 15, 2023
1 parent dfac218 commit c9258c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ client.Cards.List(
## Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 409 Conflict, 429 Rate Limit,
and >=500 Internal errors will all be retried by default.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors will all be retried by default.

You can use the `WithMaxRetries` option to configure or disable this:

Expand Down
1 change: 1 addition & 0 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (cfg *RequestConfig) Execute() error {
}

shouldRetry := err != nil ||
res.StatusCode == http.StatusRequestTimeout ||
res.StatusCode == http.StatusConflict ||
res.StatusCode == http.StatusTooManyRequests ||
res.StatusCode >= http.StatusInternalServerError
Expand Down

0 comments on commit c9258c8

Please sign in to comment.