diff --git a/CHANGELOG.md b/CHANGELOG.md index c41def229b1..13df400998b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ ## Unreleased - Add OpenStack Metrics Scaler ([#1382](https://github.com/kedacore/keda/issues/1382)) -- Fixed goroutine leaks in usage of timers ([#1704](https://github.com/kedacore/keda/pull/1704)) +- Fixed goroutine leaks in usage of timers ([#1704](https://github.com/kedacore/keda/pull/1704) | [#1739](https://github.com/kedacore/keda/pull/1739)) ### New diff --git a/pkg/scaling/scale_handler.go b/pkg/scaling/scale_handler.go index df542a44c89..19e57275140 100644 --- a/pkg/scaling/scale_handler.go +++ b/pkg/scaling/scale_handler.go @@ -140,8 +140,9 @@ func (h *scaleHandler) startScaleLoop(ctx context.Context, withTriggers *kedav1a pollingInterval := getPollingInterval(withTriggers) logger.V(1).Info("Watching with pollingInterval", "PollingInterval", pollingInterval) - tmr := time.NewTimer(pollingInterval) for { + tmr := time.NewTimer(pollingInterval) + select { case <-tmr.C: h.checkScalers(ctx, scalableObject, scalingMutex)