@@ -148,12 +148,10 @@ pub fn default_retry_config_plugin(
148148}
149149
150150/// Runtime plugin that sets the default retry strategy, config, and partition.
151- ///
151+ ///
152152/// This version respects the behavior version to enable retries by default for newer versions.
153153/// For AWS SDK clients, retries are enabled by default.
154- pub fn default_retry_config_plugin_v2 (
155- params : & DefaultPluginParams ,
156- ) -> Option < SharedRuntimePlugin > {
154+ pub fn default_retry_config_plugin_v2 ( params : & DefaultPluginParams ) -> Option < SharedRuntimePlugin > {
157155 let default_partition_name = params. retry_partition_name . as_ref ( ) ?. clone ( ) ;
158156 let is_aws_sdk = params. is_aws_sdk ;
159157 let retry_partition = RetryPartition :: new ( default_partition_name) ;
@@ -214,12 +212,15 @@ pub fn default_timeout_config_plugin() -> Option<SharedRuntimePlugin> {
214212}
215213
216214/// Runtime plugin that sets the default timeout config.
217- ///
215+ ///
218216/// This version respects the behavior version to enable connection timeout by default for newer versions.
219217/// For AWS SDK clients, connection timeout is enabled by default.
220218pub fn default_timeout_config_plugin_v2 (
221219 params : & DefaultPluginParams ,
222220) -> Option < SharedRuntimePlugin > {
221+ let behavior_version = params
222+ . behavior_version
223+ . unwrap_or_else ( BehaviorVersion :: latest) ;
223224 let is_aws_sdk = params. is_aws_sdk ;
224225 Some (
225226 default_plugin ( "default_timeout_config_plugin" , |components| {
@@ -228,17 +229,19 @@ pub fn default_timeout_config_plugin_v2(
228229 ) )
229230 } )
230231 . with_config ( layer ( "default_timeout_config" , |layer| {
231- let timeout_config = if is_aws_sdk {
232- // AWS SDK: Set connect_timeout, explicitly disable operation timeouts
233- TimeoutConfig :: builder ( )
234- . connect_timeout ( Duration :: from_millis ( 3100 ) )
235- . disable_operation_timeout ( )
236- . disable_operation_attempt_timeout ( )
237- . build ( )
238- } else {
239- // Non-AWS SDK: All timeouts disabled
240- TimeoutConfig :: disabled ( )
241- } ;
232+ #[ allow( deprecated) ]
233+ let timeout_config =
234+ if is_aws_sdk && behavior_version. is_at_least ( BehaviorVersion :: v2025_01_17 ( ) ) {
235+ // AWS SDK with new behavior version: Set connect_timeout, explicitly disable operation timeouts
236+ TimeoutConfig :: builder ( )
237+ . connect_timeout ( Duration :: from_millis ( 3100 ) )
238+ . disable_operation_timeout ( )
239+ . disable_operation_attempt_timeout ( )
240+ . build ( )
241+ } else {
242+ // Old behavior versions or non-AWS SDK: All timeouts disabled
243+ TimeoutConfig :: disabled ( )
244+ } ;
242245 layer. store_put ( timeout_config) ;
243246 } ) )
244247 . into_shared ( ) ,
@@ -452,8 +455,7 @@ mod tests {
452455 let params = DefaultPluginParams :: new ( )
453456 . with_retry_partition_name ( "test-partition" )
454457 . with_is_aws_sdk ( true ) ;
455- let plugin = default_retry_config_plugin_v2 ( & params)
456- . expect ( "plugin should be created" ) ;
458+ let plugin = default_retry_config_plugin_v2 ( & params) . expect ( "plugin should be created" ) ;
457459
458460 let config = plugin. config ( ) . expect ( "config should exist" ) ;
459461 let retry_config = config
@@ -472,8 +474,7 @@ mod tests {
472474 let params = DefaultPluginParams :: new ( )
473475 . with_retry_partition_name ( "test-partition" )
474476 . with_is_aws_sdk ( false ) ;
475- let plugin = default_retry_config_plugin_v2 ( & params)
476- . expect ( "plugin should be created" ) ;
477+ let plugin = default_retry_config_plugin_v2 ( & params) . expect ( "plugin should be created" ) ;
477478
478479 let config = plugin. config ( ) . expect ( "config should exist" ) ;
479480 let retry_config = config
0 commit comments