From effcef2184cfcb4dc5d3fc0a3c8a1e20e989a870 Mon Sep 17 00:00:00 2001 From: Anatoly Yakovenko Date: Wed, 20 Jun 2018 16:28:24 -0700 Subject: [PATCH] fixed sleep bug --- src/crdt.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crdt.rs b/src/crdt.rs index 5d713e55d8..abe1bfdca5 100644 --- a/src/crdt.rs +++ b/src/crdt.rs @@ -828,6 +828,7 @@ mod tests { use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; + use std::thread::sleep; use std::time::Duration; use streamer::default_window; @@ -1087,6 +1088,10 @@ mod tests { assert_ne!(me.id, nxt2.id); assert_ne!(nxt.id, nxt2.id); crdt.insert(&nxt2); + while now == crdt.alive[&nxt2.id] { + sleep(Duration::from_millis(GOSSIP_SLEEP_MILLIS)); + crdt.insert(&nxt2); + } let len = crdt.table.len() as u64; assert!((MIN_TABLE_SIZE as u64) < len); crdt.purge(now + len * GOSSIP_SLEEP_MILLIS * 4);