Revert "tier more important than backup"

This reverts commit bca22537c633822e5e6759fa2840712a837211fd.
This commit is contained in:
Bryan Stitt 2023-06-18 10:09:21 -07:00
parent bca22537c6
commit 2f0e6103ac

@ -239,13 +239,13 @@ impl Web3Rpc {
}
/// sort by...
/// - tier (ascending. fastest servers first)
/// - backups (primary servers first)
/// - block number (descending. synced servers first)
/// - backups last
/// - tier (ascending)
/// - block number (descending)
/// TODO: tests on this!
/// 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>) -> (u32, bool, Reverse<U64>) {
fn sort_on(&self, max_block: Option<U64>) -> (bool, u32, Reverse<U64>) {
let mut head_block = self
.head_block
.as_ref()
@ -260,13 +260,13 @@ impl Web3Rpc {
let backup = self.backup;
(tier, !backup, Reverse(head_block))
(!backup, tier, Reverse(head_block))
}
pub fn sort_for_load_balancing_on(
&self,
max_block: Option<U64>,
) -> ((u32, bool, Reverse<U64>), 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();
@ -282,7 +282,7 @@ impl Web3Rpc {
pub fn shuffle_for_load_balancing_on(
&self,
max_block: Option<U64>,
) -> ((u32, bool, Reverse<U64>), u8) {
) -> ((bool, u32, Reverse<U64>), u8) {
let sort_on = self.sort_on(max_block);
let mut rng = nanorand::tls_rng();