-
Notifications
You must be signed in to change notification settings - Fork 190
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
Improve timeout config ergonomics and add SDK default timeouts #1740
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
...gen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/rustlang/RustModule.kt
Show resolved
Hide resolved
...client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenDelegator.kt
Show resolved
Hide resolved
...client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/CodegenDelegator.kt
Show resolved
Hide resolved
...amazon/smithy/rust/codegen/client/smithy/generators/client/CustomizableOperationGenerator.kt
Show resolved
Hide resolved
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.
I left some comments but this otherwise looks great. Thanks for simplifying all this so much. I love to see changes that delete more code than they add 😄
...are/amazon/smithy/rust/codegen/client/smithy/customizations/ResiliencyConfigCustomization.kt
Show resolved
Hide resolved
let mut builder = #{aws_smithy_client}::Builder::dyn_https() | ||
.middleware(#{DynMiddleware}::new(#{Middleware}::new())); | ||
builder.set_retry_config(retry_config.into()); | ||
builder.set_timeout_config(timeout_config); | ||
// the builder maintains a try-state. To avoid suppressing the warning when sleep is unset, | ||
// only set it if we actually have a sleep impl. | ||
if let Some(sleep_impl) = sleep_impl { | ||
builder.set_sleep_impl(Some(sleep_impl)); | ||
} | ||
.middleware(#{DynMiddleware}::new(#{Middleware}::new())) | ||
.retry_config(retry_config.into()) | ||
.timeout_config(timeout_config); |
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.
Note for myself: I started integration testing the connect timeout, and that revealed that the timeout_config
here gets discarded since dyn_https()
creates the connector and has no consideration of the timeout_config
value at all.
This is another one of those weird situations with the aws_smithy_client::Builder
similar to retry_config
where you can configure a default implementation, or you can replace that implementation wholesale. I think we need to redesign this builder so that these conflicting builder methods are no longer possible. If you replace an implementation, then it shouldn't be possible to set configuration for the default.
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
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.
Server side looks good.
const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(5); | ||
const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(2); |
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.
It'd be nice if all these defaults were documented in one place in our FAQ or something. Or perhaps they could be imported from a crate of constants?
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.
On second thought, I think defining these settings in the module where they are immediately relevant is the right choice, disregard my above comment.
use crate::hyper_ext::Adapter as HyperAdapter; | ||
|
||
#[cfg(feature = "rustls")] | ||
impl<M, R> Builder<(), M, R> { |
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.
This is so clever and cool; Love it.
Opened #1771 to track fixing the examples. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
This is work towards #256 for SDK production readiness. This PR:
sleep_impl
validation takes place inside of the builder'sbuild()
method.CustomizableOperation
into its own filecrate::customizable_operation
module tocrate::operation::customize
crate::operation::customize
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.