wait for consensus rpcs to change before trying again
This commit is contained in:
parent
48905f0235
commit
08859ba04d
@ -511,6 +511,7 @@ impl Web3Rpcs {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
// TODO: include tiers in this?
|
||||||
potential_rpcs.shuffle(&mut thread_fast_rng::thread_fast_rng());
|
potential_rpcs.shuffle(&mut thread_fast_rng::thread_fast_rng());
|
||||||
|
|
||||||
match self
|
match self
|
||||||
@ -653,16 +654,21 @@ impl Web3Rpcs {
|
|||||||
|
|
||||||
match consensus_rpcs.should_wait_for_block(waiting_for, skip_rpcs) {
|
match consensus_rpcs.should_wait_for_block(waiting_for, skip_rpcs) {
|
||||||
ShouldWaitForBlock::NeverReady => break,
|
ShouldWaitForBlock::NeverReady => break,
|
||||||
ShouldWaitForBlock::Ready => {}
|
ShouldWaitForBlock::Ready => {
|
||||||
|
if Instant::now() > stop_trying_at {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
ShouldWaitForBlock::Wait { .. } => select! {
|
ShouldWaitForBlock::Wait { .. } => select! {
|
||||||
_ = watch_consensus_rpcs.changed() => {},
|
_ = watch_consensus_rpcs.changed() => {},
|
||||||
_ = sleep_until(stop_trying_at) => {},
|
_ = sleep_until(stop_trying_at) => break,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
select! {
|
||||||
if Instant::now() > stop_trying_at {
|
_ = watch_consensus_rpcs.changed() => {},
|
||||||
break;
|
_ = sleep_until(stop_trying_at) => break,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user