forked from hyperlane-xyz/hyperlane-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: lower rusoto timeout to 15s (hyperlane-xyz#3283)
### Description Applies the fix in hyperlane-xyz#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))). ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues <!-- - Fixes #[issue number here] --> ### Backward compatibility <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests -->
- Loading branch information
1 parent
68f7dee
commit e16cc70
Showing
4 changed files
with
25 additions
and
10 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)?) | ||
} |