From 4fc14b302a26174bc6ec9ab75fe4293ce8cb1151 Mon Sep 17 00:00:00 2001 From: Martin Kobetic Date: Mon, 28 Aug 2023 13:40:29 -0400 Subject: [PATCH] fix --- pkg/ratelimiter/buckets.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ratelimiter/buckets.go b/pkg/ratelimiter/buckets.go index 9cc8d96e..c0ba9fce 100644 --- a/pkg/ratelimiter/buckets.go +++ b/pkg/ratelimiter/buckets.go @@ -53,13 +53,13 @@ func (b *Buckets) deleteExpired(expiresAfter time.Duration) { // Use RLock to iterate over the map // to allow concurrent reads b.mutex.RLock() - defer b.mutex.RUnlock() var expired []string for bucket, entry := range b.buckets { if time.Since(entry.lastSeen) > expiresAfter { expired = append(expired, bucket) } } + b.mutex.RUnlock() if len(expired) == 0 { return }