[#667] writecache: Fix flush test

Allow to disable background flusher for testing purposes.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-17 17:41:13 +03:00
parent 02454df14a
commit 8d18fa159e
8 changed files with 40 additions and 36 deletions

View file

@ -36,6 +36,9 @@ const (
// runFlushLoop starts background workers which periodically flush objects to the blobstor.
func (c *cache) runFlushLoop(ctx context.Context) {
if c.disableBackgroundFlush {
return
}
for i := 0; i < c.workersCount; i++ {
c.wg.Add(1)
go c.workerFlushSmall(ctx)
@ -200,7 +203,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
return err
}
c.deleteFromDisk(ctx, []string{sAddr})
c.deleteFromDisk(ctx, e.Address)
return nil
}