-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Feature] New retries codegen changes #3849
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
Open
kai-ion
wants to merge
4
commits into
main
Choose a base branch
from
new-retry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2e441dd
Implement Retry Behavior 2.1 gated behind AWS_NEW_RETRIES_2026
kai-ion 76e08b8
rename client to lpclient for windows error
kai-ion f7fbc8c
fixed invariant and added flag for longpolling
kai-ion f870c60
static const bool so its only done once
kai-ion 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
43 changes: 43 additions & 0 deletions
43
...-cpp-sdk-dynamodbstreams/include/aws/dynamodbstreams/DynamoDBStreamsClientConfiguration.h
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,43 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <aws/core/client/GenericClientConfiguration.h> | ||
| #include <aws/dynamodbstreams/DynamoDBStreams_EXPORTS.h> | ||
|
|
||
| namespace Aws { | ||
| namespace DynamoDBStreams { | ||
| struct AWS_DYNAMODBSTREAMS_API DynamoDBStreamsClientConfiguration : public Aws::Client::GenericClientConfiguration { | ||
| using BaseClientConfigClass = Aws::Client::GenericClientConfiguration; | ||
|
|
||
| DynamoDBStreamsClientConfiguration(const Aws::Client::ClientConfigurationInitValues& configuration = {}); | ||
|
|
||
| /** | ||
| * Create a configuration based on settings in the aws configuration file for the given profile name. | ||
| * The configuration file location can be set via the environment variable AWS_CONFIG_FILE | ||
| * @param profileName the aws profile name. | ||
| * @param shouldDisableIMDS whether or not to disable IMDS calls. | ||
| */ | ||
| DynamoDBStreamsClientConfiguration(const char* profileName, bool shouldDisableIMDS = false); | ||
|
|
||
| /** | ||
| * Create a configuration with a predefined smart defaults | ||
| * @param useSmartDefaults, required to differentiate c-tors | ||
| * @param defaultMode, default mode to use | ||
| * @param shouldDisableIMDS whether or not to disable IMDS calls. | ||
| */ | ||
| DynamoDBStreamsClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false); | ||
|
|
||
| /** | ||
| * Converting constructors for compatibility with a legacy code | ||
| */ | ||
| DynamoDBStreamsClientConfiguration(const Aws::Client::ClientConfiguration& config); | ||
|
|
||
| private: | ||
| void LoadDynamoDBStreamsSpecificConfig(const Aws::String& profileName); | ||
| }; | ||
| } // namespace DynamoDBStreams | ||
| } // namespace Aws |
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
44 changes: 44 additions & 0 deletions
44
generated/src/aws-cpp-sdk-dynamodbstreams/source/DynamoDBStreamsClientConfiguration.cpp
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,44 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #include <aws/dynamodbstreams/DynamoDBStreamsClientConfiguration.h> | ||
|
|
||
| namespace Aws { | ||
| namespace DynamoDBStreams { | ||
|
|
||
| void DynamoDBStreamsClientConfiguration::LoadDynamoDBStreamsSpecificConfig(const Aws::String& inputProfileName) { | ||
| this->configFactories.retryStrategyCreateFn = []() -> std::shared_ptr<Client::RetryStrategy> { | ||
| return Client::InitRetryStrategy(4, "", 0.025); | ||
| }; | ||
| #if defined(_MSC_VER) | ||
| (&reinterpret_cast<const int&>(inputProfileName)); | ||
| #else | ||
| (void)(inputProfileName); | ||
| #endif | ||
| } | ||
|
|
||
| DynamoDBStreamsClientConfiguration::DynamoDBStreamsClientConfiguration(const Aws::Client::ClientConfigurationInitValues& configuration) | ||
| : BaseClientConfigClass(configuration) { | ||
| LoadDynamoDBStreamsSpecificConfig(this->profileName); | ||
| } | ||
|
|
||
| DynamoDBStreamsClientConfiguration::DynamoDBStreamsClientConfiguration(const char* inputProfileName, bool shouldDisableIMDS) | ||
| : BaseClientConfigClass(inputProfileName, shouldDisableIMDS) { | ||
| LoadDynamoDBStreamsSpecificConfig(Aws::String(inputProfileName)); | ||
| } | ||
|
|
||
| DynamoDBStreamsClientConfiguration::DynamoDBStreamsClientConfiguration(bool useSmartDefaults, const char* defaultMode, | ||
| bool shouldDisableIMDS) | ||
| : BaseClientConfigClass(useSmartDefaults, defaultMode, shouldDisableIMDS) { | ||
| LoadDynamoDBStreamsSpecificConfig(this->profileName); | ||
| } | ||
|
|
||
| DynamoDBStreamsClientConfiguration::DynamoDBStreamsClientConfiguration(const Aws::Client::ClientConfiguration& config) | ||
| : BaseClientConfigClass(config) { | ||
| LoadDynamoDBStreamsSpecificConfig(this->profileName); | ||
| } | ||
|
|
||
| } // namespace DynamoDBStreams | ||
| } // namespace Aws | ||
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
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
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
42 changes: 42 additions & 0 deletions
42
src/aws-cpp-sdk-core/include/aws/core/internal/LongPollingRetryHelper.h
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,42 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <aws/core/Core_EXPORTS.h> | ||
| #include <aws/core/client/AWSError.h> | ||
| #include <aws/core/client/CoreErrors.h> | ||
| #include <aws/core/client/RetryStrategy.h> | ||
|
|
||
| namespace Aws { | ||
| namespace Client { | ||
| namespace Internal { | ||
|
|
||
| /** | ||
| * For long-polling operations (e.g. SQS ReceiveMessage), when the retry strategy | ||
| * returns ShouldRetry=false due to quota exhaustion (not max attempts), apply a | ||
| * backoff delay before returning the error to the caller. This prevents all blocked | ||
| * callers from slamming the service simultaneously after quota is restored. | ||
| * | ||
| * Returns the sleep duration in milliseconds, or 0 if no sleep is needed. | ||
| */ | ||
| inline long ComputeLongPollingSleepMs( | ||
| const AWSError<CoreErrors>& error, | ||
| long retries, | ||
| const std::shared_ptr<RetryStrategy>& retryStrategy, | ||
| bool isLongPollingOperation) | ||
| { | ||
| if (!isLongPollingOperation || | ||
| !error.ShouldRetry() || | ||
| retries + 1 >= retryStrategy->GetMaxAttempts()) | ||
| { | ||
| return 0; | ||
| } | ||
| return retryStrategy->CalculateDelayBeforeNextRetry(error, retries); | ||
| } | ||
|
|
||
| } // namespace Internal | ||
| } // namespace Client | ||
| } // namespace Aws |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
AWS_UNREFERENCED_PARAMThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this codegen is from a preexisting codegen template that funnily, I had added, PR. All we did in this PR was add dynamodbstreams to the codegen path.