Skip to content

Commit

Permalink
codegen: Increase request timeout from 1min to 3min (paritytech#696)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv authored Oct 20, 2022
1 parent 2ed959e commit 1736f61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion codegen/src/utils/fetch_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use jsonrpsee::{
http_client::HttpClientBuilder,
rpc_params,
};
use std::time::Duration;

/// Returns the metadata bytes from the provided URL, blocking the current thread.
pub fn fetch_metadata_bytes_blocking(url: &Uri) -> Result<Vec<u8>, FetchMetadataError> {
Expand Down Expand Up @@ -58,14 +59,17 @@ async fn fetch_metadata_ws(url: &Uri) -> Result<String, FetchMetadataError> {
.map_err(|e| Error::Transport(e.into()))?;

let client = ClientBuilder::default()
.request_timeout(Duration::from_secs(180))
.max_notifs_per_subscription(4096)
.build_with_tokio(sender, receiver);

Ok(client.request("state_getMetadata", rpc_params![]).await?)
}

async fn fetch_metadata_http(url: &Uri) -> Result<String, FetchMetadataError> {
let client = HttpClientBuilder::default().build(url.to_string())?;
let client = HttpClientBuilder::default()
.request_timeout(Duration::from_secs(180))
.build(url.to_string())?;

Ok(client.request::<String>("state_getMetadata", None).await?)
}
Expand Down

0 comments on commit 1736f61

Please sign in to comment.