Skip to content

Commit e3fc520

Browse files
trivikrkuhe
andauthored
docs(util-retry): retryStrategy gets precedence over maxAttempts (#4739)
Co-authored-by: George Fu <[email protected]>
1 parent 42f526e commit e3fc520

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/util-retry/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ const client = new S3Client({
5252

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

55+
### MaxAttempts and RetryStrategy
56+
57+
If you provide both `maxAttempts` and `retryStrategy`, the `retryStrategy` will
58+
get precedence as it's more specific.
59+
60+
```js
61+
import { S3Client } from "@aws-sdk/client-s3";
62+
import { ConfiguredRetryStrategy } from "@aws-sdk/util-retry";
63+
64+
const client = new S3Client({
65+
maxAttempts: 2, // ignored.
66+
retryStrategy: new ConfiguredRetryStrategy(
67+
4, // used.
68+
(attempt: number) => 100 + attempt * 1000 // backoff function.
69+
),
70+
});
71+
```
72+
5573
### Further customization
5674

5775
You can implement the `RetryStrategyV2` interface.

0 commit comments

Comments
 (0)