[#1028] writecache: Evict flushed big objects

Make `flushBigObjects` routine to call `evictObjects` which was
successfully written to `BlobStor`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-12-09 15:30:45 +03:00 committed by Alex Vanin
parent d246e5193b
commit fc42844fbf

View file

@ -116,6 +116,8 @@ func (c *cache) flushBigObjects() {
for { for {
select { select {
case <-tick.C: case <-tick.C:
evictNum := 0
_ = c.fsTree.Iterate(func(addr *objectSDK.Address, data []byte) error { _ = c.fsTree.Iterate(func(addr *objectSDK.Address, data []byte) error {
sAddr := addr.String() sAddr := addr.String()
@ -131,8 +133,13 @@ func (c *cache) flushBigObjects() {
// mark object as flushed // mark object as flushed
c.store.flushed.Add(sAddr, false) c.store.flushed.Add(sAddr, false)
evictNum++
return nil return nil
}) })
// evict objects which were successfully written to BlobStor
c.evictObjects(evictNum)
case <-c.closeCh: case <-c.closeCh:
} }
} }