From f0a7c3ef02f6310369e97c309bebf50dba3f0177 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Wed, 29 Jul 2020 01:17:46 -0400 Subject: [PATCH] probe: spread probe threads out uniformly in time This way we're a little less bursty and might notice changes more quickly. --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index 007a108..fae4c43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -261,6 +261,10 @@ fn main() -> anyhow::Result<()> { } }); parent.schedule(Box::new(connect_thread)); + // Spread the probe threads out so they're somewhat uniformly distributed. + std::thread::sleep(std::time::Duration::from_micros( + DELAYSECS.flag * 1000000 / (socket_addrs.len() as u64), + )) } // Blocks forever parent.wait();