handle negative cleanupIntervals
Marco Andronaco andronacomarco@gmail.com
Thu, 10 Oct 2024 09:05:53 +0200
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
myks.go
→
myks.go
@@ -107,7 +107,7 @@ }
// StartCleanup starts a goroutine that periodically deletes all expired keys from the keystore. func (ks *KeyStore[T]) StartCleanup(cleanupInterval time.Duration) { - if cleanupInterval == 0 { + if cleanupInterval <= 0 { return }@@ -131,7 +131,7 @@ func (ks *KeyStore[T]) StopCleanup() {
ks.mu.Lock() defer ks.mu.Unlock() - if ks.cleanupInterval != 0 { + if ks.cleanupInterval > 0 { close(ks.stopChan) ks.cleanupInterval = 0 }