Skip to content

Commit

Permalink
chore: fix logging logic
Browse files Browse the repository at this point in the history
  • Loading branch information
loziniak authored and joshuef committed Mar 11, 2024
1 parent b03009f commit 2525b3f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sn_peers_acquisition/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ async fn get_network_contacts(_args: &PeersArgs) -> Result<Vec<Multiaddr>> {

#[cfg(feature = "network-contacts")]
async fn get_network_contacts(args: &PeersArgs) -> Result<Vec<Multiaddr>> {
info!("Trying to fetch the bootstrap peers from {NETWORK_CONTACTS_URL}");
println!("Trying to fetch the bootstrap peers from {NETWORK_CONTACTS_URL}");

let url = args
.network_contacts_url
.clone()
.unwrap_or(Url::parse(NETWORK_CONTACTS_URL)?);

info!("Trying to fetch the bootstrap peers from {url}");
println!("Trying to fetch the bootstrap peers from {url}");

get_bootstrap_peers_from_url(url).await
}

Expand Down Expand Up @@ -179,14 +180,14 @@ async fn get_bootstrap_peers_from_url(url: Url) -> Result<Vec<Multiaddr>> {
return Ok(multi_addresses);
} else {
return Err(Error::NoMultiAddrObtainedFromNetworkContacts(
NETWORK_CONTACTS_URL.to_string(),
url.to_string(),
));
}
} else {
retries += 1;
if retries >= MAX_NETWORK_CONTACTS_GET_RETRIES {
return Err(Error::NetworkContactsUnretrievable(
NETWORK_CONTACTS_URL.to_string(),
url.to_string(),
MAX_NETWORK_CONTACTS_GET_RETRIES,
));
}
Expand All @@ -196,7 +197,7 @@ async fn get_bootstrap_peers_from_url(url: Url) -> Result<Vec<Multiaddr>> {
retries += 1;
if retries >= MAX_NETWORK_CONTACTS_GET_RETRIES {
return Err(Error::NetworkContactsUnretrievable(
NETWORK_CONTACTS_URL.to_string(),
url.to_string(),
MAX_NETWORK_CONTACTS_GET_RETRIES,
));
}
Expand Down

0 comments on commit 2525b3f

Please sign in to comment.