-
Notifications
You must be signed in to change notification settings - Fork 340
feat(sdk): support per-request timeout to TCP/QUIC/WebSocket clients #3429
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ pub struct TcpClientConfig { | |
| pub reconnection: TcpClientReconnectionConfig, | ||
| /// Interval of heartbeats sent by the client | ||
| pub heartbeat_interval: IggyDuration, | ||
| /// Per-request timeout for send/receive operations. | ||
| pub request_timeout: IggyDuration, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adding a pub field here is a breaking change for anyone constructing this struct with a literal without |
||
| /// Disable Nagle algorithm for the TCP socket. | ||
| pub nodelay: bool, | ||
| } | ||
|
|
@@ -54,6 +56,7 @@ impl Default for TcpClientConfig { | |
| tls_ca_file: None, | ||
| tls_validate_certificate: true, | ||
| heartbeat_interval: IggyDuration::from_str("5s").unwrap(), | ||
| request_timeout: IggyDuration::from_str("300s").unwrap(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. heads up this is a behavior change - before this, requests had no deadline, now they default to 300s. anything that legitimately takes longer than 300s on a connection now returns |
||
| auto_login: AutoLogin::Disabled, | ||
| reconnection: TcpClientReconnectionConfig::default(), | ||
| nodelay: false, | ||
|
|
@@ -73,6 +76,7 @@ impl From<ConnectionString<TcpConnectionStringOptions>> for TcpClientConfig { | |
| tls_validate_certificate: true, | ||
| reconnection: connection_string.options().reconnection().to_owned(), | ||
| heartbeat_interval: connection_string.options().heartbeat_interval(), | ||
| request_timeout: IggyDuration::from_str("300s").unwrap(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this hardcodes 300s instead of reading from the connection string like the field right above it ( |
||
| nodelay: connection_string.options().nodelay(), | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,6 +120,7 @@ impl ClientProviderConfig { | |
| keep_alive_interval: args.quic_keep_alive_interval, | ||
| max_idle_timeout: args.quic_max_idle_timeout, | ||
| validate_certificate: args.quic_validate_certificate, | ||
| request_timeout: IggyDuration::from_str(&args.request_timeout).unwrap(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| })); | ||
| } | ||
| TransportProtocol::Http => { | ||
|
|
@@ -148,6 +149,7 @@ impl ClientProviderConfig { | |
| ) | ||
| .unwrap(), | ||
| }, | ||
| request_timeout: IggyDuration::from_str(&args.request_timeout).unwrap(), | ||
| auto_login: if auto_login { | ||
| AutoLogin::Enabled(Credentials::UsernamePassword( | ||
| args.username, | ||
|
|
@@ -181,6 +183,7 @@ impl ClientProviderConfig { | |
| } else { | ||
| AutoLogin::Disabled | ||
| }, | ||
| request_timeout: IggyDuration::from_str(&args.request_timeout).unwrap(), | ||
| ws_config: WebSocketConfig::default(), | ||
| tls_enabled: args.websocket_tls_enabled, | ||
| tls_domain: args.websocket_tls_domain, | ||
|
|
||
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.
300s is IMHO overkill. make it 10s or so.