mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 12:06:57 +00:00
Autoscaling: Percentage runners busy - remove magic number used for round up (#235)
* remove magic number for autoscaling Co-authored-by: Zachary Benamram <zacharybenamram@blend.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -218,7 +219,7 @@ func (r *HorizontalRunnerAutoscalerReconciler) calculateReplicasByPercentageRunn
|
||||
var desiredReplicas int
|
||||
fractionBusy := float64(numRunnersBusy) / float64(numRunners)
|
||||
if fractionBusy >= scaleUpThreshold {
|
||||
scaleUpReplicas := int(float64(numRunners)*scaleUpFactor + 0.5)
|
||||
scaleUpReplicas := int(math.Ceil(float64(numRunners) * scaleUpFactor))
|
||||
if scaleUpReplicas > maxReplicas {
|
||||
desiredReplicas = maxReplicas
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user