Skip to content

fix(worker-manager): shouldWorkerTerminate uses new targetCapacity estimator for decisioning#8329

Merged
matt-boris merged 1 commit intomainfrom
matt-boris/wmShouldWorkerTerminateFix
Mar 2, 2026
Merged

fix(worker-manager): shouldWorkerTerminate uses new targetCapacity estimator for decisioning#8329
matt-boris merged 1 commit intomainfrom
matt-boris/wmShouldWorkerTerminateFix

Conversation

@matt-boris
Copy link
Contributor

@matt-boris matt-boris commented Feb 27, 2026

Fixes #8328.

Worker Manager: the worker scanner now uses a dedicated target capacity formula for termination decisions based on pending tasks, claimed tasks, and minCapacity/maxCapacity. Previously, the provisioning formula was reused, which inflated the target by existing worker counts, so idle workers were never terminated even when minCapacity was lowered to 0.

@lotas
Copy link
Contributor

lotas commented Mar 2, 2026

I think I understand the issue better now, looks like using desiredCapacity for the should worker terminate logic was not correct. We should think about something better, because for every case where pending < existing we will have this issue - more workers would be "requested to stay"

@matt-boris matt-boris marked this pull request as draft March 2, 2026 12:14
@matt-boris matt-boris force-pushed the matt-boris/wmShouldWorkerTerminateFix branch from 352d70b to f8eba98 Compare March 2, 2026 12:30
@matt-boris matt-boris changed the title fix(worker-manager): shouldWorkerTerminate uses latest minCapacity config fix(worker-manager): shouldWorkerTerminate uses new targetCapacity estimator for decisioning Mar 2, 2026
@matt-boris matt-boris force-pushed the matt-boris/wmShouldWorkerTerminateFix branch from 68aa1e4 to 34e9154 Compare March 2, 2026 13:13
Copy link
Contributor

@lotas lotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like this way better! Keeping things really simple with this target capacity! Thanks

@matt-boris matt-boris force-pushed the matt-boris/wmShouldWorkerTerminateFix branch from 34e9154 to 1892695 Compare March 2, 2026 13:47
@matt-boris matt-boris marked this pull request as ready for review March 2, 2026 13:49
@matt-boris matt-boris enabled auto-merge March 2, 2026 13:50
@matt-boris matt-boris merged commit 296e247 into main Mar 2, 2026
73 checks passed
@matt-boris matt-boris deleted the matt-boris/wmShouldWorkerTerminateFix branch March 2, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker scanner's termination formula inflates target capacity with existing worker counts

2 participants