From 1736f618d940a69ab212a686984c3be25b08d1c2 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:17:28 +0300 Subject: [PATCH] codegen: Increase request timeout from 1min to 3min (#696) Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- codegen/src/utils/fetch_metadata.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codegen/src/utils/fetch_metadata.rs b/codegen/src/utils/fetch_metadata.rs index f417aa3e32..d205b3bc5f 100644 --- a/codegen/src/utils/fetch_metadata.rs +++ b/codegen/src/utils/fetch_metadata.rs @@ -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, FetchMetadataError> { @@ -58,6 +59,7 @@ async fn fetch_metadata_ws(url: &Uri) -> Result { .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 { } async fn fetch_metadata_http(url: &Uri) -> Result { - 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::("state_getMetadata", None).await?) }