Fix retries - this is working

This commit is contained in:
Tommy Verrall
2025-10-20 18:28:25 +02:00
committed by Jędrzej Stuczyński
parent 5a491f0a7e
commit 2428374fe7
2 changed files with 22 additions and 2 deletions
@@ -74,6 +74,10 @@ use url::Url;
#[cfg(debug_assertions)]
use wasm_utils::console_log;
/// Default number of retries for Nym API requests when using network details with domain fronting.
/// This allows the client to try alternative URLs if the primary endpoint is unavailable.
const DEFAULT_NYM_API_RETRIES: usize = 3;
#[cfg(all(
not(target_arch = "wasm32"),
feature = "fs-surb-storage",
@@ -882,14 +886,20 @@ where
config: &Config,
user_agent: Option<UserAgent>,
) -> Result<nym_http_api_client::Client, ClientCoreError> {
tracing::debug!(
"construct_nym_api_client called with network_details: {}",
network_details.is_some()
);
// If network details are provided, use from_network() which handles domain fronting
if let Some(network_details) = network_details {
tracing::debug!(
tracing::info!(
"Building nym-api client from network details (with domain fronting support)"
);
let mut builder = nym_http_api_client::ClientBuilder::from_network(network_details)
.map_err(ClientCoreError::from)?;
.map_err(ClientCoreError::from)?
.with_retries(DEFAULT_NYM_API_RETRIES);
if let Some(user_agent) = user_agent {
builder = builder.with_user_agent(user_agent);
+10
View File
@@ -706,6 +706,16 @@ where
.config
.as_base_client_config(nyxd_endpoints, nym_api_endpoints.clone());
tracing::debug!(
"SDK: Passing network_details to BaseClientBuilder (has {} nym_api_urls)",
self.config
.network_details
.nym_api_urls
.as_ref()
.map(|urls| urls.len())
.unwrap_or(0)
);
let mut base_builder: BaseClientBuilder<_, _> =
BaseClientBuilder::new(base_config, self.storage, self.dkg_query_client)
.with_network_details(self.config.network_details.clone())