Skip to content

Commit 244d271

Browse files
committed
fix: prevent autoscaler scale down overshoot in worker
1 parent 9834976 commit 244d271

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/worker/autoscaler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ func (a *autoscaler) adjust(ctx context.Context, target uint16) {
160160
target = a.maxWorkers
161161
}
162162

163-
current := uint16(a.currentWorkerCntFn())
163+
// use desired count (not live activeWorkers) to prevent overshoot
164+
// when previous despawn signals haven't been processed yet
165+
current := uint16(a.desiredWorkerCnt.Load())
164166
if target == current {
165167
return
166168
}

0 commit comments

Comments
 (0)