File tree Expand file tree Collapse file tree 3 files changed +8
-16
lines changed
Expand file tree Collapse file tree 3 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -501,7 +501,7 @@ namespace Aws
501501 * Number of total attempts to make when retrieving data from IMDS. Default 1.
502502 */
503503 long metadataServiceNumAttempts = 1 ;
504-
504+
505505 /* *
506506 * Timeout in seconds when retrieving data from IMDS. Default 1.
507507 */
@@ -512,20 +512,15 @@ namespace Aws
512512 */
513513 std::shared_ptr<RetryStrategy> imdsRetryStrategy;
514514 } imdsConfig;
515-
516- /* *
517- * Region to use for calls
518- */
519- Aws::String region;
520515 }credentialProviderConfig;
521516 };
522517
523518 /* *
524519 * A helper function to initialize a retry strategy.
525520 * Default is DefaultRetryStrategy (i.e. exponential backoff)
526521 */
527- AWS_CORE_API std::shared_ptr<RetryStrategy> InitRetryStrategy (Aws::String retryMode = " " );
528- AWS_CORE_API std::shared_ptr<RetryStrategy> InitRetryStrategy (int maxRetries , Aws::String retryMode = " " );
522+ std::shared_ptr<RetryStrategy> InitRetryStrategy (Aws::String retryMode = " " );
523+ std::shared_ptr<RetryStrategy> InitRetryStrategy (int maxAttempts , Aws::String retryMode = " " );
529524
530525 /* *
531526 * A helper function to compute a user agent
Original file line number Diff line number Diff line change @@ -316,10 +316,9 @@ void setConfigFromEnvOrProfile(ClientConfiguration &config)
316316 long attempts = static_cast <long >(Aws::Utils::StringUtils::ConvertToInt32 (numAttemptsStr.c_str ()));
317317 config.credentialProviderConfig .imdsConfig .metadataServiceNumAttempts = attempts;
318318
319- // Ensure retry strategy is set using factory pattern
320- if (!config.retryStrategy ) {
321- config.retryStrategy = config.configFactories .retryStrategyCreateFn ();
322- }
319+ // Initialize IMDS-specific retry strategy with configured number of attempts
320+ // Uses default retry mode with the specified max attempts from metadata_service_num_attempts
321+ config.credentialProviderConfig .imdsConfig .imdsRetryStrategy = InitRetryStrategy (attempts, " " );
323322}
324323
325324ClientConfiguration::ClientConfiguration ()
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ namespace Aws
8282 AWSHttpResourceClient::AWSHttpResourceClient (const Aws::Client::ClientConfiguration& clientConfiguration, const char * logtag)
8383 : m_logtag(logtag),
8484 m_userAgent (Aws::Client::ComputeUserAgentString(&clientConfiguration)),
85- m_retryStrategy(clientConfiguration.retryStrategy),
85+ m_retryStrategy(clientConfiguration.retryStrategy ? clientConfiguration.retryStrategy : clientConfiguration.configFactories.retryStrategyCreateFn() ),
8686 m_httpClient(nullptr )
8787 {
8888 AWS_LOGSTREAM_INFO (m_logtag.c_str (),
@@ -213,10 +213,8 @@ namespace Aws
213213 [&credentialConfig]() -> ClientConfiguration{
214214 Aws::Client::ClientConfiguration clientConfig;
215215 clientConfig.credentialProviderConfig = credentialConfig;
216- clientConfig.connectTimeoutMs = credentialConfig.imdsConfig .metadataServiceTimeout * 1000 ;
217216 clientConfig.requestTimeoutMs = credentialConfig.imdsConfig .metadataServiceTimeout * 1000 ;
218- clientConfig.retryStrategy = Aws::MakeShared<DefaultRetryStrategy>(
219- RESOURCE_CLIENT_CONFIGURATION_ALLOCATION_TAG, credentialConfig.imdsConfig .metadataServiceNumAttempts - 1 , 1000 );
217+ clientConfig.retryStrategy = credentialConfig.imdsConfig .imdsRetryStrategy ;
220218 return clientConfig;
221219 }(),
222220 EC2_METADATA_CLIENT_LOG_TAG),
You can’t perform that action at this time.
0 commit comments