Skip to content

Commit

Permalink
Update guides/retry_backoff.md
Browse files Browse the repository at this point in the history
Co-authored-by: Jakob <[email protected]>
Signed-off-by: Yu Zhang <[email protected]>
  • Loading branch information
zhyu and Jakob3xD committed Jul 1, 2024
1 parent 2336e8e commit 07c2b89
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions guides/retry_backoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ func main() {

func example() error {
client, err := opensearchapi.NewClient(opensearchapi.Config{
// Retry on 429 TooManyRequests statuses as well (502, 503, 504 are default values)
//
RetryOnStatus: []int{502, 503, 504, 429},
// Retry on 429 TooManyRequests statuses as well (502, 503, 504 are default values)
RetryOnStatus: []int{502, 503, 504, 429},

// A simple incremental backoff function
//
RetryBackoff: func(i int) time.Duration { return time.Duration(i) * 100 * time.Millisecond },
// A simple incremental backoff function
RetryBackoff: func(i int) time.Duration { return time.Duration(i) * 100 * time.Millisecond },

// Retry up to 5 attempts (1 initial + 4 retries)
//
MaxRetries: 4,
// Retry up to 5 attempts (1 initial + 4 retries)
MaxRetries: 4,
})
if err != nil {
return err
Expand Down

0 comments on commit 07c2b89

Please sign in to comment.