1
0
mirror of synced 2025-02-10 22:56:51 +00:00

fix: make validator swarm polling more deterministic

This commit is contained in:
Roman 2024-10-29 16:29:07 +08:00
parent 8216868f76
commit 1fddd4ee81
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75

View File

@ -331,6 +331,7 @@ mod tests {
messages_to_expect: usize,
) -> (usize, usize) {
let (mut msg_0_counter, mut msg_1_counter) = (0, 0);
loop {
tokio::select! {
Some(event) = swarm.next() => {
@ -357,6 +358,9 @@ mod tests {
_ = time::sleep(Duration::from_secs(4)) => {
if msg_0_counter < messages_to_expect && msg_1_counter < messages_to_expect {
warn!("Validator timeout reached");
if !swarm.behaviour_mut().tasks.is_empty() {
continue;
}
}
break;
}