From e10c423ad366bc7e45007ac74a9848828780768b Mon Sep 17 00:00:00 2001 From: benthecarman Date: Tue, 26 Mar 2024 16:16:36 -0500 Subject: [PATCH] Always update gateway cache before selecting gateway --- src/mint.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mint.rs b/src/mint.rs index 0a88942..37a94b7 100644 --- a/src/mint.rs +++ b/src/mint.rs @@ -51,6 +51,12 @@ impl MultiMintWrapperTrait for MultiMintWrapper { .await .expect("just registered"); + // update gateway cache, so we can find the best gateways + let ln = client.get_first_module::(); + if let Err(e) = ln.update_gateway_cache(true).await { + error!("Failed to update gateway cache: {e}"); + } + if let Some(gateway) = select_gateway(&client).await { self.gateways.write().await.insert(id, gateway); } else { @@ -76,6 +82,12 @@ pub(crate) async fn setup_multimint( // select gateway for each federation for (id, client) in clients.iter() { + // update gateway cache, so we can find the best gateways + let ln = client.get_first_module::(); + if let Err(e) = ln.update_gateway_cache(true).await { + error!("Failed to update gateway cache: {e}"); + } + match select_gateway(client).await { Some(gateway) => { gateways.insert(*id, gateway);