demotes WeightedShuffle failures to error metrics (#24079)

Since call-sites are calling unwrap anyways, panicking seems too punitive
for our use cases.
This commit is contained in:
behzad nouri
2022-04-03 16:20:06 +00:00
committed by GitHub
parent fa7eb7f30c
commit 7cb3b6cbe2
6 changed files with 57 additions and 32 deletions

View File

@@ -326,7 +326,7 @@ pub fn new_cluster_nodes<T: 'static>(
.collect();
let broadcast = TypeId::of::<T>() == TypeId::of::<BroadcastStage>();
let stakes: Vec<u64> = nodes.iter().map(|node| node.stake).collect();
let mut weighted_shuffle = WeightedShuffle::new(&stakes).unwrap();
let mut weighted_shuffle = WeightedShuffle::new("cluster-nodes", &stakes);
if broadcast {
weighted_shuffle.remove_index(index[&self_pubkey]);
}