Skip to content

Commit

Permalink
perf: resolve trusted nodes concurrently (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jul 4, 2024
1 parent 0373c58 commit e7803f3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/node/builder/src/launch/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,16 @@ impl LaunchContextWith<WithConfigs> {
info!(target: "reth::cli", "Adding trusted nodes");

// resolve trusted peers if they use a domain instead of dns
for peer in &self.attachment.config.network.trusted_peers {
let resolved = futures::future::try_join_all(
self.attachment.config.network.trusted_peers.iter().map(|peer| async move {
let backoff = ConstantBuilder::default()
.with_max_times(self.attachment.config.network.dns_retries);
let resolved = (move || { peer.resolve() })
.retry(&backoff)
.notify(|err, _| warn!(target: "reth::cli", "Error resolving peer domain: {err}. Retrying..."))
.await?;
self.attachment.toml_config.peers.trusted_nodes.insert(resolved);
}
(move || { peer.resolve() })
.retry(&backoff)
.notify(|err, _| warn!(target: "reth::cli", "Error resolving peer domain: {err}. Retrying..."))
.await
})).await?;
self.attachment.toml_config.peers.trusted_nodes.extend(resolved);
}
Ok(self)
}
Expand Down

0 comments on commit e7803f3

Please sign in to comment.