diff --git a/common/http-api-client/src/lib.rs b/common/http-api-client/src/lib.rs index 4407260adf..564d6874bb 100644 --- a/common/http-api-client/src/lib.rs +++ b/common/http-api-client/src/lib.rs @@ -604,9 +604,13 @@ impl Client { /// Create new instance of `Client` using the provided base url and existing client config pub fn clone_with_new_url(&self, new_url: Url) -> Self { Client { - base_url: new_url, + base_urls: vec![new_url], + current_idx: Arc::new(Default::default()), reqwest_client: self.reqwest_client.clone(), + front: self.front.clone(), + retry_limit: self.retry_limit, + #[cfg(target_arch = "wasm32")] request_timeout: self.request_timeout, } diff --git a/nym-api/enter_db.sh b/nym-api/enter_db.sh index 4ec2a09253..e2230554c9 100755 --- a/nym-api/enter_db.sh +++ b/nym-api/enter_db.sh @@ -1,2 +1,2 @@ #!/bin/sh -sqlite3 -init settings.sql /Users/jedrzej/workspace/nym/target/debug/build/nym-api-10a9906acce21392/out/nym-api-example.sqlite \ No newline at end of file +sqlite3 -init settings.sql /Users/jedrzej/workspace/nym/target/debug/build/nym-api-4b7e804a8ee69b15/out/nym-api-example.sqlite \ No newline at end of file diff --git a/nym-node/src/node/nym_apis_client.rs b/nym-node/src/node/nym_apis_client.rs index 918e3a756c..08ef68aff7 100644 --- a/nym-node/src/node/nym_apis_client.rs +++ b/nym-node/src/node/nym_apis_client.rs @@ -26,6 +26,7 @@ pub struct NymApisClient { } struct InnerClient { + // NOTE: this was implemented before the internal http client supported multiple URLs active_client: NymApiClient, available_urls: Vec, shutdown_token: ShutdownToken, @@ -122,7 +123,10 @@ impl InnerClient { { let broadcast_fut = stream::iter(self.available_urls.clone()).for_each_concurrent(None, |url| { - let nym_api = self.active_client.nym_api.clone_with_new_url(url.clone()); + let nym_api = self + .active_client + .nym_api + .clone_with_new_url(url.clone().into()); let req_fut = req(nym_api, request_body); async move { if let Err(err) = req_fut.await { @@ -168,7 +172,10 @@ impl InnerClient { .skip(last_working) .chain(self.available_urls.iter().enumerate().take(last_working)) { - let nym_api = self.active_client.nym_api.clone_with_new_url(url.clone()); + let nym_api = self + .active_client + .nym_api + .clone_with_new_url(url.clone().into()); let timeout_fut = sleep(timeout_duration); let query_fut = req(nym_api);