Add in jitter in case there are many that all try to cleanuo at the same time

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-09-14 11:24:32 -07:00
parent 392f25b6da
commit 22f40eafa0

View File

@@ -1567,7 +1567,8 @@ func (o *consumer) deleteNotActive() {
startInterval = 5 * time.Second
maxInterval = 5 * time.Minute
)
interval := startInterval
jitter := time.Duration(rand.Int63n(int64(startInterval)))
interval := startInterval + jitter
ticker := time.NewTicker(interval)
defer ticker.Stop()
for range ticker.C {