From 50433fe2654d1744ba77b4b073723677c15ae537 Mon Sep 17 00:00:00 2001 From: Andrej Mihajlov Date: Thu, 23 Apr 2026 16:29:02 +0200 Subject: [PATCH] Only init SHARED_CLIENT if requested --- common/http-api-client/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/http-api-client/src/lib.rs b/common/http-api-client/src/lib.rs index 9d94dcf30e..856b2ad0e7 100644 --- a/common/http-api-client/src/lib.rs +++ b/common/http-api-client/src/lib.rs @@ -1152,7 +1152,10 @@ impl ApiClientCore for Client { #[cfg(target_arch = "wasm32")] let response: Result = { - let client = self.reqwest_client.as_ref().unwrap_or(&*SHARED_CLIENT); + let client = self + .reqwest_client + .as_ref() + .unwrap_or_else(|| &*SHARED_CLIENT); Ok( wasmtimer::tokio::timeout(self.request_timeout, client.execute(req)) .await @@ -1162,7 +1165,10 @@ impl ApiClientCore for Client { #[cfg(not(target_arch = "wasm32"))] let response = { - let client = self.reqwest_client.as_ref().unwrap_or(&*SHARED_CLIENT); + let client = self + .reqwest_client + .as_ref() + .unwrap_or_else(|| &*SHARED_CLIENT); client.execute(req).await };