diff --git a/pkg/local_object_storage/writecache/flush.go b/pkg/local_object_storage/writecache/flush.go index fa1ac903..8dfed500 100644 --- a/pkg/local_object_storage/writecache/flush.go +++ b/pkg/local_object_storage/writecache/flush.go @@ -44,11 +44,14 @@ func (c *cache) flushLoop() { c.flushBigObjects() }() - tick := time.NewTicker(defaultFlushInterval) + tt := time.NewTimer(defaultFlushInterval) + defer tt.Stop() + for { select { - case <-tick.C: + case <-tt.C: c.flush() + tt.Reset(defaultFlushInterval) case <-c.closeCh: c.log.Debug("waiting for workers to quit") wg.Wait()