diff --git a/cache/cache.go b/cache/cache.go index 96cde8b..6d0b9bd 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -69,12 +69,13 @@ func (sc *ScoreCache) Add(score float64, ip netip.Addr, ts time.Time) { func (lc *ScoreCache) Get(ip netip.Addr) (ServerScore, error) { now := time.Now() lc.mu.RLock() - defer lc.mu.RUnlock() cachedScore, ok := lc.scores[ip] if !ok { + lc.mu.RUnlock() return ServerScore{}, newCacheMissError() } + lc.mu.RUnlock() if now.After(cachedScore.expiresAt) { lc.delete(ip)