From c6811c992b7c100c87526838527a6c7898c24218 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 4 Nov 2024 09:49:57 +0100 Subject: [PATCH] apply feedback Signed-off-by: Jorge Turrado --- pkg/scaling/cache/scalers_cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/scaling/cache/scalers_cache.go b/pkg/scaling/cache/scalers_cache.go index 58a8c41ac3e..332a419b504 100644 --- a/pkg/scaling/cache/scalers_cache.go +++ b/pkg/scaling/cache/scalers_cache.go @@ -89,10 +89,10 @@ func (c *ScalersCache) GetPushScalers() []scalers.PushScaler { // Close closes all scalers in the cache func (c *ScalersCache) Close(ctx context.Context) { - c.mutex.RLock() - defer c.mutex.RUnlock() + c.mutex.Lock() scalers := c.Scalers c.Scalers = nil + c.mutex.Unlock() for _, s := range scalers { err := s.Scaler.Close(ctx) if err != nil {