Skip to content

Commit

Permalink
Wait for msg arriving in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma233 committed Mar 22, 2024
1 parent 0c72962 commit 0e02493
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions crates/core/src/dht/chord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,10 @@ impl Chord<PeerRingAction> for PeerRing {

let succ = {
if successor.is_empty()? || self.bias(did) <= self.bias(successor.min()?) {
println!("===> 1");
// If the did is closer to self than successor, return successor as the
// successor of that did.
Ok(PeerRingAction::Some(successor.min()?))
} else {
println!("===> 2");
// Otherwise, find the closest preceding node and ask it to find the successor.
let closest_predecessor = finger.closest_predecessor(did);
Ok(PeerRingAction::RemoteAction(
Expand Down
1 change: 1 addition & 0 deletions crates/node/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ mod test {
let uuid2 = p2.send_message(did1, test_text2.as_bytes()).await.unwrap();
println!("send_message 2 done, msg id: {}", uuid2);

tokio::time::sleep(std::time::Duration::from_secs(1)).await;
println!("check received");

let mut msgs2 = callback2.msgs.try_lock().unwrap();
Expand Down

0 comments on commit 0e02493

Please sign in to comment.