Skip to content

Commit 0f32fbf

Browse files
committed
Small fixes
1 parent 9f19878 commit 0f32fbf

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

crates/tako/src/internal/scheduler/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct WorkerTypeState {
1010
max: u32,
1111
}
1212

13-
/* Read the documentation of WorkerTypeQuery in gateway.rs */
13+
/* Read the documentation of `new_worker_query`` in control.rs */
1414
pub(crate) fn compute_new_worker_query(
1515
core: &mut Core,
1616
queries: &[WorkerTypeQuery],

crates/tako/src/internal/server/workerload.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ impl WorkerLoad {
270270
pub(crate) fn utilization(&self, wr: &WorkerResources) -> f32 {
271271
let mut utilization = 0.0f32;
272272
for (n, w) in self.n_resources.iter().zip(wr.n_resources.iter()) {
273-
utilization = utilization.max(n.as_f32() / w.as_f32());
273+
utilization = utilization.max(if w.is_zero() {
274+
0.0
275+
} else {
276+
n.as_f32() / w.as_f32()
277+
});
274278
}
275279
utilization
276280
}

0 commit comments

Comments
 (0)