forked from TrueCloudLab/frostfs-node
[#1462] writecache: Use Timer
instead of Ticker
in flush
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
5073a37930
commit
0148209168
1 changed files with 5 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue