From 7ea1eb6046a8133937b72ccbb6f486f656562367 Mon Sep 17 00:00:00 2001 From: Keith Duncan Date: Wed, 9 Jun 2021 09:11:18 +1000 Subject: [PATCH] Revert shortfall scaling added in #40 --- scaler/scaling_calculator.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/scaler/scaling_calculator.go b/scaler/scaling_calculator.go index 409a95e..b1b9ec6 100644 --- a/scaler/scaling_calculator.go +++ b/scaler/scaling_calculator.go @@ -33,25 +33,5 @@ func (sc *ScalingCalculator) DesiredCount(metrics *buildkite.AgentMetrics, asg * desired = sc.perInstance(agentsRequired) } - // If there are less agents registered than we'd expect based on the size - // of the autoscaling group, then there may be instances not accepting - // jobs: possibly because they are in the process of draining jobs for a - // graceful shutdown. In this case, we should expand the asg further to - // accommodate. - // - // Currently, restrict this behaviour to only occur when there are fewer - // than 2 instances (worth of agents) running. This will prevent any - // unexpected behaviour in large scaling groups. Since the effects of an - // instance not accepting jobs are more pronounced when there are fewer - // instances, this should cover the worst case scenario(s) where there may - // not be any instances accepting jobs. - if metrics.TotalAgents < int64(sc.agentsPerInstance) * 2 { - anticipated := (asg.DesiredCount - asg.Pending) * int64(sc.agentsPerInstance) - shortfall := anticipated - metrics.TotalAgents - if shortfall > 0 { - desired += sc.perInstance(shortfall) - } - } - return desired }