Revert "temp fix while filtering is improved"
This reverts commit 5367c511953fcea1af3da1d905de06d9e76711ba.
This commit is contained in:
parent
5367c51195
commit
8b22c9861b
@ -1437,8 +1437,7 @@ mod tests {
|
||||
|
||||
let names_in_sort_order: Vec<_> = rpcs.iter().map(|x| x.name.as_str()).collect();
|
||||
|
||||
// TODO: if we prioritize tier over block_num, this is:["c", "b", "a", "f", "e", "d"]
|
||||
assert_eq!(names_in_sort_order, ["c", "f", "b", "e", "a", "d"]);
|
||||
assert_eq!(names_in_sort_order, ["c", "b", "a", "f", "e", "d"]);
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
|
@ -233,12 +233,12 @@ impl Web3Rpc {
|
||||
|
||||
/// sort by...
|
||||
/// - backups last
|
||||
/// - block number (descending)
|
||||
/// - tier (ascending)
|
||||
/// - block number (descending)
|
||||
/// TODO: tests on this!
|
||||
/// TODO: should tier or block number take priority? it depends on the request. need to make sure filtering is right and then it should work tier before block_number
|
||||
/// TODO: should tier or block number take priority?
|
||||
/// TODO: should this return a struct that implements sorting traits?
|
||||
fn sort_on(&self, max_block: Option<U64>) -> (bool, Reverse<U64>, u32) {
|
||||
fn sort_on(&self, max_block: Option<U64>) -> (bool, u32, Reverse<U64>) {
|
||||
let mut head_block = self
|
||||
.head_block
|
||||
.as_ref()
|
||||
@ -253,13 +253,13 @@ impl Web3Rpc {
|
||||
|
||||
let backup = self.backup;
|
||||
|
||||
(!backup, Reverse(head_block), tier)
|
||||
(!backup, tier, Reverse(head_block))
|
||||
}
|
||||
|
||||
pub fn sort_for_load_balancing_on(
|
||||
&self,
|
||||
max_block: Option<U64>,
|
||||
) -> ((bool, Reverse<U64>, u32), OrderedFloat<f64>) {
|
||||
) -> ((bool, u32, Reverse<U64>), OrderedFloat<f64>) {
|
||||
let sort_on = self.sort_on(max_block);
|
||||
|
||||
let weighted_peak_ewma_seconds = self.weighted_peak_ewma_seconds();
|
||||
@ -275,7 +275,7 @@ impl Web3Rpc {
|
||||
pub fn shuffle_for_load_balancing_on(
|
||||
&self,
|
||||
max_block: Option<U64>,
|
||||
) -> ((bool, Reverse<U64>, u32), u8) {
|
||||
) -> ((bool, u32, Reverse<U64>), u8) {
|
||||
let sort_on = self.sort_on(max_block);
|
||||
|
||||
let mut rng = nanorand::tls_rng();
|
||||
|
Loading…
Reference in New Issue
Block a user