-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: backport rusoto timeout change to v2 (#3872)
Backport of #3283 Applies the fix in #2384 everywhere an `HttpClient` is constructed via rusoto. It lowers the S3 timeout to 15s based on tips in [this thread](hyperium/hyper#2136 (comment)), to avoid `Error during dispatch: connection closed before message completed` errors. Note that we'll probably still run into these issues, but less frequently ([source](rusoto/rusoto#1766 (comment))).
- Loading branch information
1 parent
0810fa0
commit 3813233
Showing
5 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use std::time::Duration; | ||
|
||
use eyre::Result; | ||
use rusoto_core::{HttpClient, HttpConfig}; | ||
|
||
/// See https://github.com/hyperium/hyper/issues/2136#issuecomment-589488526 | ||
pub const HYPER_POOL_IDLE_TIMEOUT: Duration = Duration::from_secs(15); | ||
|
||
/// Create a new HTTP client with a timeout for the connection pool. | ||
/// This is a workaround for https://github.com/hyperium/hyper/issues/2136#issuecomment-589345238 | ||
pub fn http_client_with_timeout() -> Result<HttpClient> { | ||
let mut config = HttpConfig::new(); | ||
config.pool_idle_timeout(HYPER_POOL_IDLE_TIMEOUT); | ||
Ok(HttpClient::new_with_config(config)?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters