codegen: Increase request timeout from 1min to 3min (#696)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-10-20 16:17:28 +03:00
committed by GitHub
parent 2ed959e0e3
commit 1736f618d9
+5 -1
View File
@@ -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> {
@@ -58,6 +59,7 @@ 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);
@@ -65,7 +67,9 @@ async fn fetch_metadata_ws(url: &Uri) -> Result<String, FetchMetadataError> {
}
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?)
}