Skip to content

Commit

Permalink
Decrease request_timeout in builders to avoid panics (#4267)
Browse files Browse the repository at this point in the history
  • Loading branch information
elmattic authored Apr 24, 2024
1 parent e10d304 commit 805a921
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
- [#4177](https://github.com/ChainSafe/forest/pull/4177) Fixed a bug where the
environment variable `IPFS_GATEWAY` was not used to change the IPFS gateway.

- [#4267](https://github.com/ChainSafe/forest/pull/4267) Fixed potential panics
in `forest-tool api compare`.

## Forest 0.17.2 "Dovakhin"

This is a **mandatory** release for all mainnet node operators. It changes the
Expand Down
6 changes: 3 additions & 3 deletions src/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Debug for UrlClient {

impl UrlClient {
async fn new(url: Url, token: impl Into<Option<String>>) -> Result<Self, ClientError> {
let timeout = Duration::MAX; // we handle timeouts ourselves.
const ONE_DAY: Duration = Duration::from_secs(24 * 3600); // we handle timeouts ourselves.
let headers = match token.into() {
Some(token) => HeaderMap::from_iter([(
header::AUTHORIZATION,
Expand All @@ -172,9 +172,9 @@ impl UrlClient {
"ws" | "wss" => OneClientInner::Ws(
jsonrpsee::ws_client::WsClientBuilder::new()
.set_headers(headers)
.request_timeout(timeout)
.max_request_size(MAX_REQUEST_BODY_SIZE)
.max_response_size(MAX_RESPONSE_BODY_SIZE)
.request_timeout(ONE_DAY)
.build(&url)
.await?,
),
Expand All @@ -183,7 +183,7 @@ impl UrlClient {
.set_headers(headers)
.max_request_size(MAX_REQUEST_BODY_SIZE)
.max_response_size(MAX_RESPONSE_BODY_SIZE)
.request_timeout(timeout)
.request_timeout(ONE_DAY)
.build(&url)?,
),
it => {
Expand Down

0 comments on commit 805a921

Please sign in to comment.