always wait for watch_ranked_rpcs change

This commit is contained in:
Bryan Stitt 2023-09-19 14:42:31 -07:00
parent ca2056e16f
commit f0be8b992b

@ -594,15 +594,16 @@ impl Web3Rpcs {
match ranked_rpcs.should_wait_for_block(waiting_for, skip_rpcs) { match ranked_rpcs.should_wait_for_block(waiting_for, skip_rpcs) {
ShouldWaitForBlock::NeverReady => break, ShouldWaitForBlock::NeverReady => break,
ShouldWaitForBlock::Ready => { // TODO: think about this more. but for now lets always wait for ranked to change
if start.elapsed() > max_wait { // ShouldWaitForBlock::Ready => {
break; // if start.elapsed() > max_wait {
} // break;
// TODO: i don't see how we can get here. something feels wrong if this is common. // }
// maybe from a race? maybe _best_available_rpc returned NotReady just as a node synced // // TODO: i don't see how we can get here. something feels wrong if this is common.
yield_now().await; // // maybe from a race? maybe _best_available_rpc returned NotReady just as a node synced
} // yield_now().await;
ShouldWaitForBlock::Wait { .. } => select! { // }
ShouldWaitForBlock::Ready | ShouldWaitForBlock::Wait { .. } => select! {
_ = watch_ranked_rpcs.changed() => { _ = watch_ranked_rpcs.changed() => {
// no need to borrow_and_update because we do that at the top of the loop // no need to borrow_and_update because we do that at the top of the loop
// TODO: wait until watched_ranked_rpcs is on the right block? // TODO: wait until watched_ranked_rpcs is on the right block?