Skip to content

Commit

Permalink
Fix error in connectivity check
Browse files Browse the repository at this point in the history
  • Loading branch information
iduartgomez committed Dec 14, 2023
1 parent c8db726 commit 5f77a3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/core/src/node/testing_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ impl SimNetwork {

tracing::info!("Number of simulated nodes: {num_nodes}");

let missing_percent = (num_nodes - missing.len()) as f64 / num_nodes as f64;
let missing_percent = 1.0 - ((num_nodes - missing.len()) as f64 / num_nodes as f64);
if missing_percent > (percent + 0.01/* 1% error tolerance */) {
missing.sort();
let show_max = missing.len().min(100);
Expand Down
7 changes: 6 additions & 1 deletion crates/fdev/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ impl TestConfig {
Duration::from_millis(self.connection_wait_ms.unwrap_or_else(|| {
// expect a peer to take max 200ms to connect, this should happen in parallel
// but err on the side of safety
(conns_per_gw * 200.0).ceil() as u64
(conns_per_gw
* self
.peer_start_backoff_ms
.map(|ms| ms as f64)
.unwrap_or(200.0))
.ceil() as u64
}));
(connectivity_timeout, conn_percent)
}
Expand Down

0 comments on commit 5f77a3a

Please sign in to comment.