-
Notifications
You must be signed in to change notification settings - Fork 195
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
test: override connect_timeout and read_timeout in clients #2333
Conversation
yes thanks for adding this test! I had spotted this issue in #2151 . We'll try to get a fix out soon |
Hey @Oliboy50, the issue here is not so much that connectors are broken but that this has a bad user-experience. When any type that implements the However, you can pass an Here's an example of what creating and passing a let connector_fn =
|connector_settings: &ConnectorSettings, sleep_impl: Option<Arc<dyn AsyncSleep>>| {
let mut conn = hyper_ext::Adapter::builder()
.connector_settings(connector_settings.clone());
conn.set_sleep_impl(sleep_impl);
Some(DynConnector::new(
conn.build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_webpki_roots()
.https_or_http()
.enable_http1()
.build(),
),
))
};
let conf = SdkConfig::builder()
.http_connector(HttpConnector::ConnectorFn(Arc::new(connector_fn)))
.sleep_impl(default_async_sleep().unwrap())
.build();
let client = aws_sdk_dynamodb::Client::from_conf(
aws_sdk_dynamodb::config::Builder::from(&conf)
.timeout_config(
TimeoutConfig::builder()
.connect_timeout(Duration::from_millis(connect_timeout_value))
.build(),
)
.build(),
); Now, the 100ms timeout will work. Let me know if you have any questions about this. I'll try to think of a more friendly API. |
thanks for the explanation 👍 actually, as a simple user, I would not even think of building my own simply using so I'll wait for the issue linked by @rcoh to be fixed 👌 BTW, because of how accurate it is, I really love the BTW2, would you want me to close this PR now or keep it open until the issue is fixed? |
I'll close this PR because we have @rcoh's issue. Thank you for bringing more attention to this issue. |
Motivation and Context
A simple PR to reproduce the fact that
connect_timeout
is not properly applied on a DynamoDB client constructed from a SDK config that already has a real http_connector set (e.g. when users runaws_config::load_from_env().await
).ℹ️ The bug is also present for
read_timeout
(but I don't know how to write an integration test for that).ℹ️ The bug is not present for
operation_timeout
andoperation_attempt_timeout
(probably because they are not set on the http_connector).Description
Only added an integration test, because I don't know how to fix this bug.
Testing
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.