-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: new retries implementation #3269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yenfryherrerafeliz
merged 3 commits into
aws:master
from
yenfryherrerafeliz:feat_new_retries
May 1, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [ | ||
| { | ||
| "type": "feature", | ||
| "category": "Retries", | ||
| "description": "Adds an opt-in new retry behavior. Set AWS_NEW_RETRIES_2026=true to enable the new path. When the env var is unset (the default), retry behavior is unchanged from previous releases. With the flag enabled, the SDK switches the default retry mode from 'legacy' to 'standard', adopts a throttling-aware token-bucket retry quota (cost 14 for non-throttling, 5 for throttling), reduces the non-throttling base backoff to 50ms, checks max-attempts before quota, honors the x-amz-retry-after header, sleeps without retrying on long-polling operations (SQS, SFN, SWF) when the quota is exhausted, and lets custom deciders supplement (rather than replace) built-in retryability checks. DynamoDB defaults to 4 attempts with a 25ms base; STS treats IDPCommunicationError as transient; S3's existing custom decider keeps its socket carve-out. The flag is intended as an opt-in for early adopters and will become the default in a future release." | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
| namespace Aws\Retry\V3; | ||
|
|
||
| /** | ||
| * Operations that use server-side long polling and should not be retried | ||
| * when the retry quota is exhausted; instead the middleware sleeps for | ||
| * the computed backoff and lets the next request proceed. | ||
| * | ||
| * @internal | ||
| */ | ||
| final class LongPolling | ||
| { | ||
| private const OPERATIONS = [ | ||
| 'sqs' => ['ReceiveMessage' => true], | ||
| 'states' => ['GetActivityTask' => true], | ||
| 'swf' => [ | ||
| 'PollForActivityTask' => true, | ||
| 'PollForDecisionTask' => true, | ||
| ], | ||
| ]; | ||
|
|
||
| public static function isLongPolling(?string $service, string $operation): bool | ||
| { | ||
| return $service !== null | ||
| && isset(self::OPERATIONS[$service][$operation]); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
| namespace Aws\Retry\V3; | ||
|
|
||
| /** | ||
| * Source of truth for the AWS_NEW_RETRIES_2026 opt-in flag. The env var | ||
| * is read once per process and memoized so retry decisions do not pay a | ||
| * getenv() cost on every attempt. | ||
| * | ||
| * @internal | ||
| */ | ||
| final class OptIn | ||
| { | ||
| public const ENV = 'AWS_NEW_RETRIES_2026'; | ||
|
|
||
| private static ?bool $enabled = null; | ||
|
|
||
| public static function isEnabled(): bool | ||
| { | ||
| if (self::$enabled === null) { | ||
| $value = getenv(self::ENV); | ||
| if (is_string($value) && trim($value) === 'true') { | ||
| self::$enabled = true; | ||
| } else { | ||
| self::$enabled = false; | ||
| } | ||
| } | ||
|
|
||
| return self::$enabled; | ||
| } | ||
|
|
||
| /** | ||
| * Clears the memoized value. Test hook only. | ||
| * | ||
| * @internal | ||
| */ | ||
| public static function reset(): void | ||
| { | ||
| self::$enabled = null; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.