From 5bc424cd4832acd0a254d3d15b87d2c8b9ae1d38 Mon Sep 17 00:00:00 2001 From: rjsadow Date: Wed, 9 Aug 2023 12:35:02 -0400 Subject: [PATCH] fix lru race condition Signed-off-by: rjsadow --- prow/config/cache.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prow/config/cache.go b/prow/config/cache.go index 74ab6a80c0d0..578cf51dca67 100644 --- a/prow/config/cache.go +++ b/prow/config/cache.go @@ -194,6 +194,8 @@ func NewInRepoConfigCache( seenOrgRepos := make(map[OrgRepo]int) cacheSizeMetrics := func() { + lruCache.Mutex.Lock() // Lock the mutex + defer lruCache.Mutex.Unlock() // Unlock the mutex when done // Record all unique orgRepo combinations we've seen so far. for _, key := range lruCache.Keys() { org, repo, err := keyToOrgRepo(key)