Skip to content

Commit

Permalink
fix(ctl): allocate more instances than workers available
Browse files Browse the repository at this point in the history
  • Loading branch information
lffg committed Jun 21, 2024
1 parent 21f724c commit a03144e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ctl/src/deployer/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ pub fn rand_many(
workers: &[WorkerDetails],
instances: u32,
) -> impl Iterator<Item = (InstanceId, IpAddr)> + '_ {
workers
.choose_multiple(&mut rand::thread_rng(), instances as usize)
let mut rng = rand::thread_rng();
(0..instances)
// Unwrap is safe since an eventual 0..0 wouldn't yield any iterations.
.map(move |_| workers.choose(&mut rng).unwrap())
.map(|w| (InstanceId(Uuid::now_v7()), w.addr))
}

Expand Down

0 comments on commit a03144e

Please sign in to comment.