From 2ba6d77ee7361e679ce008289c2a328476cd0b88 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 23 Apr 2024 12:59:34 -0400 Subject: [PATCH] Reduce target peers a bit --- coordinator/src/p2p.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coordinator/src/p2p.rs b/coordinator/src/p2p.rs index e042a695..29a0dbb4 100644 --- a/coordinator/src/p2p.rs +++ b/coordinator/src/p2p.rs @@ -371,7 +371,7 @@ impl LibP2p { } // TODO: If a network has less than TARGET_PEERS, this will cause retries ad infinitum - const TARGET_PEERS: usize = 8; + const TARGET_PEERS: usize = 5; // The addrs we're currently dialing, and the networks associated with them let dialing_peers = Arc::new(RwLock::new(HashMap::new())); @@ -493,8 +493,8 @@ impl LibP2p { continue; } - // Randomly select up to 2 * TARGET_PEERS - for _ in 0 .. (2 * TARGET_PEERS) { + // Randomly select up to 150% of the TARGET_PEERS + for _ in 0 .. ((3 * TARGET_PEERS) / 2) { if !nodes.is_empty() { let to_connect = nodes.swap_remove( usize::try_from(OsRng.next_u64() % u64::try_from(nodes.len()).unwrap())