From 29cebb3d950f061b6f7517a7703713a58e1d039e Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 5 Apr 2022 18:04:03 +0300 Subject: [PATCH] lib/workingsetcache: check more frequently for cache size overflow This should reduce the probability of cache size limit overflow --- lib/workingsetcache/cache.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/workingsetcache/cache.go b/lib/workingsetcache/cache.go index 0b3e043d46..6192fb5155 100644 --- a/lib/workingsetcache/cache.go +++ b/lib/workingsetcache/cache.go @@ -149,8 +149,6 @@ func (c *Cache) expirationWatcher(expireDuration time.Duration) { prev := c.prev.Load().(*fastcache.Cache) prev.Reset() curr := c.curr.Load().(*fastcache.Cache) - var cs fastcache.Stats - curr.UpdateStats(&cs) c.prev.Store(curr) // Use c.maxBytes/2 instead of cs.MaxBytesSize for creating new cache, // since cs.MaxBytesSize may not match c.maxBytes/2, so the created cache @@ -162,7 +160,7 @@ func (c *Cache) expirationWatcher(expireDuration time.Duration) { } func (c *Cache) cacheSizeWatcher() { - t := time.NewTicker(time.Minute) + t := time.NewTicker(1500 * time.Millisecond) defer t.Stop() var maxBytesSize uint64