Skip to content

Commit

Permalink
Always update gateway cache before selecting gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Mar 26, 2024
1 parent 4a5f6d5 commit e10c423
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<LightningClientModule>();
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 {
Expand All @@ -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::<LightningClientModule>();
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);
Expand Down

0 comments on commit e10c423

Please sign in to comment.