Skip to content

Commit

Permalink
docs(util-retry): retryStrategy gets precedence over maxAttempts (#4739)
Browse files Browse the repository at this point in the history
Co-authored-by: George Fu <kuhe@users.noreply.github.com>
  • Loading branch information
trivikr and kuhe authored May 19, 2023
1 parent 42f526e commit e3fc520
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/util-retry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ const client = new S3Client({

This example sets the backoff at 100ms plus 1s per attempt.

### MaxAttempts and RetryStrategy

If you provide both `maxAttempts` and `retryStrategy`, the `retryStrategy` will
get precedence as it's more specific.

```js
import { S3Client } from "@aws-sdk/client-s3";
import { ConfiguredRetryStrategy } from "@aws-sdk/util-retry";

const client = new S3Client({
maxAttempts: 2, // ignored.
retryStrategy: new ConfiguredRetryStrategy(
4, // used.
(attempt: number) => 100 + attempt * 1000 // backoff function.
),
});
```

### Further customization

You can implement the `RetryStrategyV2` interface.
Expand Down

0 comments on commit e3fc520

Please sign in to comment.