[router] upgrade rand to latest version (#9017)
This commit is contained in:
@@ -55,13 +55,13 @@ impl LoadBalancingPolicy for PowerOfTwoPolicy {
|
||||
}
|
||||
|
||||
// Select two random workers
|
||||
let mut rng = rand::thread_rng();
|
||||
let idx1 = rng.gen_range(0..healthy_indices.len());
|
||||
let mut idx2 = rng.gen_range(0..healthy_indices.len());
|
||||
let mut rng = rand::rng();
|
||||
let idx1 = rng.random_range(0..healthy_indices.len());
|
||||
let mut idx2 = rng.random_range(0..healthy_indices.len());
|
||||
|
||||
// Ensure we pick two different workers
|
||||
while idx2 == idx1 {
|
||||
idx2 = rng.gen_range(0..healthy_indices.len());
|
||||
idx2 = rng.random_range(0..healthy_indices.len());
|
||||
}
|
||||
|
||||
let worker_idx1 = healthy_indices[idx1];
|
||||
|
||||
@@ -29,8 +29,8 @@ impl LoadBalancingPolicy for RandomPolicy {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
let random_idx = rng.gen_range(0..healthy_indices.len());
|
||||
let mut rng = rand::rng();
|
||||
let random_idx = rng.random_range(0..healthy_indices.len());
|
||||
let worker = workers[healthy_indices[random_idx]].url();
|
||||
|
||||
RouterMetrics::record_processed_request(worker);
|
||||
|
||||
Reference in New Issue
Block a user