From 6f4d575f0466be4a3ebe4bae9d7bedd24a0b8ba4 Mon Sep 17 00:00:00 2001 From: Laurent Commarieu Date: Thu, 31 Oct 2019 09:39:13 +0100 Subject: [PATCH] fix(autoscaling): test out before in --- pkg/autoscale/autoscale.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/autoscale/autoscale.go b/pkg/autoscale/autoscale.go index 76ba982..1d3dfea 100644 --- a/pkg/autoscale/autoscale.go +++ b/pkg/autoscale/autoscale.go @@ -69,14 +69,6 @@ func (a *AutoScale) autoscaleJob(jobID string, policies map[string]*policy.Group var count int switch { - case cpuUsage < pol.ScaleInCPUPercentageThreshold: - scalingDir = scale.DirectionIn - count = pol.ScaleInCount - updateAutoscaleMeta(group, "cpu", cpuUsage, pol.ScaleInCPUPercentageThreshold, meta) - case memUsage < pol.ScaleInMemoryPercentageThreshold: - scalingDir = scale.DirectionIn - count = pol.ScaleInCount - updateAutoscaleMeta(group, "memory", memUsage, pol.ScaleInMemoryPercentageThreshold, meta) case cpuUsage > pol.ScaleOutCPUPercentageThreshold: scalingDir = scale.DirectionOut count = pol.ScaleOutCount @@ -85,6 +77,14 @@ func (a *AutoScale) autoscaleJob(jobID string, policies map[string]*policy.Group scalingDir = scale.DirectionOut count = pol.ScaleOutCount updateAutoscaleMeta(group, "memory", memUsage, pol.ScaleOutMemoryPercentageThreshold, meta) + case cpuUsage < pol.ScaleInCPUPercentageThreshold: + scalingDir = scale.DirectionIn + count = pol.ScaleInCount + updateAutoscaleMeta(group, "cpu", cpuUsage, pol.ScaleInCPUPercentageThreshold, meta) + case memUsage < pol.ScaleInMemoryPercentageThreshold: + scalingDir = scale.DirectionIn + count = pol.ScaleInCount + updateAutoscaleMeta(group, "memory", memUsage, pol.ScaleInMemoryPercentageThreshold, meta) } if scalingDir != "" {