Skip to content

Commit

Permalink
Add sleep to trim_test to wait for all nodes to decide before trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldng committed Oct 25, 2023
1 parent 306c420 commit 71ec9a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions omnipaxos/tests/trim_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ fn trim_test() {
});
}

// wait until all nodes have decided last entry
// wait until nodes have decided last entry
match FutureCollection::collect_with_timeout::<Vec<_>>(futures, cfg.wait_timeout) {
Ok(_) => {}
Err(e) => panic!("Error on collecting futures of decided proposals: {}", e),
}

thread::sleep(cfg.wait_timeout); // wait a little longer so that ALL nodes decide

elected_leader.on_definition(|x| {
x.paxos.trim(Some(cfg.trim_idx)).expect("Failed to trim");
});
Expand Down Expand Up @@ -99,12 +101,14 @@ fn double_trim_test() {
});
}

// wait until all nodes have decided last entry
// wait until nodes have decided last entry
match FutureCollection::collect_with_timeout::<Vec<_>>(futures, cfg.wait_timeout) {
Ok(_) => {}
Err(e) => panic!("Error on collecting futures of decided proposals: {}", e),
}

thread::sleep(cfg.wait_timeout); // wait a little longer so that ALL nodes decide

let second_trim_idx = cfg.trim_idx + TRIM_INDEX_INCREMENT;
elected_leader.on_definition(|x| {
x.paxos
Expand Down

0 comments on commit 71ec9a1

Please sign in to comment.