From f0be8b992b3cdbb3b5d6a6dcc0954864ac989278 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 19 Sep 2023 14:42:31 -0700 Subject: [PATCH] always wait for watch_ranked_rpcs change --- web3_proxy/src/rpcs/many.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/web3_proxy/src/rpcs/many.rs b/web3_proxy/src/rpcs/many.rs index 4cd3036a..878cd35b 100644 --- a/web3_proxy/src/rpcs/many.rs +++ b/web3_proxy/src/rpcs/many.rs @@ -594,15 +594,16 @@ impl Web3Rpcs { match ranked_rpcs.should_wait_for_block(waiting_for, skip_rpcs) { ShouldWaitForBlock::NeverReady => break, - ShouldWaitForBlock::Ready => { - 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 - yield_now().await; - } - ShouldWaitForBlock::Wait { .. } => select! { + // TODO: think about this more. but for now lets always wait for ranked to change + // ShouldWaitForBlock::Ready => { + // 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 + // yield_now().await; + // } + ShouldWaitForBlock::Ready | ShouldWaitForBlock::Wait { .. } => select! { _ = watch_ranked_rpcs.changed() => { // 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?