diff --git a/pkg/auth/validation_cache.go b/pkg/auth/validation_cache.go index ad0886d..95e8563 100644 --- a/pkg/auth/validation_cache.go +++ b/pkg/auth/validation_cache.go @@ -117,6 +117,14 @@ func (vc *ValidationCache) Size() int { return len(vc.cache) } +// Stop terminates the background cleanup goroutine. Safe to call multiple +// times; subsequent calls are no-ops. +func (vc *ValidationCache) Stop() { + vc.stopOnce.Do(func() { + close(vc.stopCh) + }) +} + // cleanupExpired removes expired entries periodically. Exits when Stop is // called. func (vc *ValidationCache) cleanupExpired() {