Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(node): tuning range based search performance
Browse files Browse the repository at this point in the history
maqi committed Nov 27, 2024
1 parent 1c21f8c commit e3eb3b2
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sn_networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
@@ -612,7 +612,7 @@ impl SwarmDriver {
// Optionally force remove all the connections for a provided peer.
fn remove_outdated_connections(&mut self) {
// To avoid this being called too frequenctly, only carry out prunning intervally.
if Instant::now() > self.last_connection_pruning_time + Duration::from_secs(30) {
if Instant::now() < self.last_connection_pruning_time + Duration::from_secs(30) {
return;
}
self.last_connection_pruning_time = Instant::now();
4 changes: 3 additions & 1 deletion sn_node/src/node.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ const TIME_STEP: usize = 20;

/// Interval to carryout network density sampling
/// This is the max time it should take. Minimum interval at any node will be half this
const NETWORK_DENSITY_SAMPLING_INTERVAL_MAX_S: u64 = 180;
const NETWORK_DENSITY_SAMPLING_INTERVAL_MAX_S: u64 = 200;

/// Helper to build and run a Node
pub struct NodeBuilder {
@@ -863,6 +863,8 @@ impl Node {
network.add_network_density_sample(distance);
}
}
// Sleep a short while to avoid causing a spike on resource usage.
std::thread::sleep(std::time::Duration::from_secs(10));
}
}
}

0 comments on commit e3eb3b2

Please sign in to comment.