mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-09-30 04:50:40 +02:00
The scaleset listener no longer dissects the message it polls. It owns session management, polling and acking, and hands the whole message to a single Scale call, so acquiring jobs and recording metrics move to the only component that still reads them. That handover is what makes the work parallelisable. The listener used to replay a message one API call at a time, in a fixed order: every job started patch, then every job completed, then the scale patch. The job events touch distinct EphemeralRunners and carry no ordering between them, so they now run across a bounded worker pool, with the worker that patches the EphemeralRunnerSet running alongside them. The one ordering that does matter is kept. deleteIdleEphemeralRunners skips a runner only once it carries a job request ID, so a patch that lowers the replica count could offer up a runner that just picked up a job if it were published while job started patches were still in flight. The scaling worker therefore waits for the event workers on a scale down, and only then. A patch that scales up or holds cannot delete anything. Kubernetes has no bulk write: get, create, update, patch and delete are single-resource verbs, and deletecollection is the only collection-scoped mutating verb there is, so N events cannot be collapsed into fewer requests. Server side apply is a PATCH on one object URI and does not change that. Issuing the N patches concurrently over the one HTTP/2 connection is the available win; the alternative is writing fewer objects, which trades N cheap independent writes for one contended, watch-amplifying, size-bounded write. The pool size is configurable through listenerConfig.scaler.workers, alongside the existing qps and burst, and defaults to 10: two calls per event keeps a full pool well inside the default QPS budget. Statistics are now cached by the scaler. The listener stopped tracking them, and a long poll that times out carries no message at all, so without the cache an idle scale set would stop converging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>