next_available should not be reversed and other bugs

This commit is contained in:
Bryan Stitt 2023-10-07 16:12:51 -07:00
parent 5fe5b97aef
commit 7e0b6c3034
2 changed files with 19 additions and 3 deletions

View File

@ -1011,6 +1011,12 @@ impl RpcsForRequest {
stream! {
loop {
if self.request.ttl_expired() {
break;
} else {
yield_now().await;
}
let mut earliest_retry_at = None;
let mut wait_for_sync = None;
@ -1130,7 +1136,17 @@ impl RpcsForRequest {
(Some(wait_for_sync), Some(retry_at)) => {
select! {
x = wait_for_sync => {
todo!()
match x {
Ok(rpc) => {
trace!(%rpc, "rpc ready. it might be used on the next loop");
// TODO: try a handle now?
continue;
},
Err(err) => {
trace!(?err, "problem while waiting for an rpc for a request");
break;
},
}
}
_ = sleep_until(retry_at) => {
yield_now().await;

View File

@ -259,7 +259,7 @@ impl Web3Rpc {
&self,
max_block: Option<U64>,
start_instant: Instant,
) -> (Reverse<Instant>, bool, Reverse<U64>, u32) {
) -> (Instant, bool, Reverse<U64>, u32) {
let mut head_block = self
.head_block_sender
.as_ref()
@ -276,7 +276,7 @@ impl Web3Rpc {
let next_available = self.next_available(start_instant);
(Reverse(next_available), !backup, Reverse(head_block), tier)
(next_available, !backup, Reverse(head_block), tier)
}
/// sort with `sort_on` and then on `weighted_peak_latency`