Skip to content

Commit 0b3c289

Browse files
authored
Merge pull request #7679 from macsko/improve_frequentloops_when_only_provisioning_requests_processing_is_productive
Improve frequent loops when only one of activities is productive
2 parents 64ca097 + e7811b8 commit 0b3c289

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cluster-autoscaler/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,13 @@ func run(healthCheck *metrics.HealthCheck, debuggingSnapshotter debuggingsnapsho
670670

671671
// Autoscale ad infinitum.
672672
if *frequentLoopsEnabled {
673+
// We need to have two timestamps because the scaleUp activity alternates between processing ProvisioningRequests,
674+
// so we need to pass the older timestamp (previousRun) to trigger.Wait to run immediately if only one of the activities is productive.
673675
lastRun := time.Now()
676+
previousRun := time.Now()
674677
for {
675-
trigger.Wait(lastRun)
676-
lastRun = time.Now()
678+
trigger.Wait(previousRun)
679+
previousRun, lastRun = lastRun, time.Now()
677680
loop.RunAutoscalerOnce(autoscaler, healthCheck, lastRun)
678681
}
679682
} else {

0 commit comments

Comments
 (0)