[#569] writecache: Refactor flush

Make single RUnlock call instead of two.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-12-27 11:38:10 +03:00
parent 0cb0fc1735
commit 32c282ca10

View file

@ -138,13 +138,11 @@ func (c *cache) flushSmallObjects(ctx context.Context) {
}
}
if count == 0 {
c.modeMtx.RUnlock()
if count == 0 {
break
}
c.modeMtx.RUnlock()
c.log.Debug(logs.WritecacheTriedToFlushItemsFromWritecache,
zap.Int("count", count),
zap.String("start", base58.Encode(lastKey)))