diff --git a/impls/src/client_utils/client.rs b/impls/src/client_utils/client.rs index a0f42dec..9e465d0b 100644 --- a/impls/src/client_utils/client.rs +++ b/impls/src/client_utils/client.rs @@ -319,9 +319,13 @@ impl Client { if Handle::try_current().is_ok() { let rt = RUNTIME.clone(); let client = self.clone(); - std::thread::spawn(move || rt.lock().unwrap().block_on(client.send_request_async(req))) - .join() - .unwrap() + std::thread::spawn(move || { + rt.lock() + .unwrap() + .block_on(async { client.send_request_async(req).await }) + }) + .join() + .unwrap() } else { RUNTIME .lock() diff --git a/impls/src/node_clients/http.rs b/impls/src/node_clients/http.rs index 6e383e81..0efe775e 100644 --- a/impls/src/node_clients/http.rs +++ b/impls/src/node_clients/http.rs @@ -230,6 +230,7 @@ impl NodeClient for HTTPNodeClient { let url = format!("{}{}", self.node_url(), ENDPOINT); let api_secret = self.node_api_secret(); + let cl = self.client.clone(); let task = async move { let params: Vec<_> = query_params .chunks(chunk_size) @@ -243,7 +244,7 @@ impl NodeClient for HTTPNodeClient { let mut tasks = Vec::with_capacity(params.len()); for req in &reqs { - tasks.push(self.client.post_async::( + tasks.push(cl.post_async::( url.as_str(), req, api_secret.clone(), @@ -254,7 +255,11 @@ impl NodeClient for HTTPNodeClient { task.try_collect().await }; - let res: Result, _> = RUNTIME.lock().unwrap().block_on(task); + let rt = RUNTIME.clone(); + let res: Result, _> = + std::thread::spawn(move || rt.lock().unwrap().block_on(async move { task.await })) + .join() + .unwrap(); let results: Vec = match res { Ok(resps) => {