wait for consensus rpcs to change before trying again

This commit is contained in:
Bryan Stitt 2023-05-28 22:37:37 -07:00
parent 48905f0235
commit 08859ba04d

@ -511,6 +511,7 @@ impl Web3Rpcs {
.cloned()
.collect();
// TODO: include tiers in this?
potential_rpcs.shuffle(&mut thread_fast_rng::thread_fast_rng());
match self
@ -653,16 +654,21 @@ impl Web3Rpcs {
match consensus_rpcs.should_wait_for_block(waiting_for, skip_rpcs) {
ShouldWaitForBlock::NeverReady => break,
ShouldWaitForBlock::Ready => {}
ShouldWaitForBlock::Ready => {
if Instant::now() > stop_trying_at {
break;
}
}
ShouldWaitForBlock::Wait { .. } => select! {
_ = watch_consensus_rpcs.changed() => {},
_ = sleep_until(stop_trying_at) => {},
_ = sleep_until(stop_trying_at) => break,
},
}
}
if Instant::now() > stop_trying_at {
break;
} else {
select! {
_ = watch_consensus_rpcs.changed() => {},
_ = sleep_until(stop_trying_at) => break,
}
}
}
}