Skip to content
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

Change timeout settings to merge them when configuration is merged #3405

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

rcoh
Copy link
Collaborator

@rcoh rcoh commented Feb 12, 2024

Motivation and Context

For context, see #3408

Description

  • During invoke, load all timeout configs and merge them via a custom loader.
  • Fix config bag bugs that prevented using a Stored type that differed from T.
  • Add new e2e and codegen integration test validating that timeout settings are properly merged.
  • Add fallback for an empty timeout config being equivalent to TimeoutConfig::disabled.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@@ -51,7 +51,7 @@ fun awsSdkIntegrationTest(

fun awsIntegrationTestParams() =
IntegrationTestParams(
cargoCommand = "cargo test --features test-util behavior-version-latest",
cargoCommand = "cargo test --features test-util,behavior-version-latest --tests --lib",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the --tests --lib args actually doing anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! they mean we don't run doc tests which changes the test run for 30 seconds to one second

@@ -60,3 +66,60 @@ async fn timeouts_can_be_set_by_service() {
// it's shorter than the 5 second timeout if the test is broken
assert!(start.elapsed() < Duration::from_millis(500));
}

/// Use a 5 second operation timeout on SdkConfig and a 0ms operation timeout on the service config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment doesn't match reality

rustTemplate(
"""
pub fn set_timeout_config(&mut self, timeout_config: #{Option}<#{TimeoutConfig}>) -> &mut Self {
timeout_config.map(|t| self.config.store_put(t));
let mut timeout_config = timeout_config.unwrap_or_else(#{TimeoutConfig}::disabled);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like unexpected behavior? Setting it to None disables all timeouts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh...that's a good point actually. I thought that was how it used to behave but that's wrong. Will fix. Good catch

Comment on lines +314 to +316
impl Store for MergeTimeoutConfig {
type ReturnedType<'a> = TimeoutConfig;
type StoredType = <StoreReplace<TimeoutConfig> as Store>::StoredType;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯

I had no idea this was possible.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh marked this pull request as ready for review February 13, 2024 19:57
@rcoh rcoh requested review from a team as code owners February 13, 2024 19:57
@rcoh rcoh enabled auto-merge February 13, 2024 19:57
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh added this pull request to the merge queue Feb 13, 2024
Merged via the queue into main with commit 1ea9d05 Feb 13, 2024
41 checks passed
@rcoh rcoh deleted the merge-timeouts branch February 13, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants