diff --git a/aws/rust-runtime/aws-config/src/imds/client.rs b/aws/rust-runtime/aws-config/src/imds/client.rs index 75fca7600b..8131415f4f 100644 --- a/aws/rust-runtime/aws-config/src/imds/client.rs +++ b/aws/rust-runtime/aws-config/src/imds/client.rs @@ -595,16 +595,14 @@ impl ClassifyRetry for ImdsResponseRetryClassifier { // This catch-all includes successful responses that fail to parse. These should not be retried. _ => RetryAction::NoActionIndicated, } + } else if self.retry_connect_timeouts { + RetryAction::server_error() } else { - if self.retry_connect_timeouts { - RetryAction::server_error() - } else { - // This is the default behavior. - // Don't retry timeouts for IMDS, or else it will take ~30 seconds for the default - // credentials provider chain to fail to provide credentials. - // Also don't retry non-responses. - RetryAction::NoActionIndicated - } + // This is the default behavior. + // Don't retry timeouts for IMDS, or else it will take ~30 seconds for the default + // credentials provider chain to fail to provide credentials. + // Also don't retry non-responses. + RetryAction::NoActionIndicated } } }