tier more important than backup
we filter backups when they aren't needed, so this should be okay
This commit is contained in:
parent
e54299beca
commit
bca22537c6
@ -239,13 +239,13 @@ impl Web3Rpc {
|
||||
}
|
||||
|
||||
/// sort by...
|
||||
/// - backups last
|
||||
/// - tier (ascending)
|
||||
/// - block number (descending)
|
||||
/// - tier (ascending. fastest servers first)
|
||||
/// - backups (primary servers first)
|
||||
/// - block number (descending. synced servers first)
|
||||
/// 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>) -> (bool, u32, Reverse<U64>) {
|
||||
fn sort_on(&self, max_block: Option<U64>) -> (u32, bool, Reverse<U64>) {
|
||||
let mut head_block = self
|
||||
.head_block
|
||||
.as_ref()
|
||||
@ -260,13 +260,13 @@ impl Web3Rpc {
|
||||
|
||||
let backup = self.backup;
|
||||
|
||||
(!backup, tier, Reverse(head_block))
|
||||
(tier, !backup, Reverse(head_block))
|
||||
}
|
||||
|
||||
pub fn sort_for_load_balancing_on(
|
||||
&self,
|
||||
max_block: Option<U64>,
|
||||
) -> ((bool, u32, Reverse<U64>), OrderedFloat<f64>) {
|
||||
) -> ((u32, bool, 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>,
|
||||
) -> ((bool, u32, Reverse<U64>), u8) {
|
||||
) -> ((u32, bool, 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