[#933] write-cache: Use real number of objects in counters

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-10-19 19:22:47 +03:00 committed by Alex Vanin
parent 29955a3036
commit 616013cb8a

View file

@ -91,9 +91,12 @@ func (x *counters) Read() error {
x.cDB.Store(inDB)
// FIXME: calculate the actual value in FSTree (new method?).
// For now we can think that db/fs = 50/50.
x.cFS.Store(inDB)
inFS, err := x.fs.NumberOfObjects()
if err != nil {
return fmt.Errorf("could not read write-cache FS counter: %w", err)
}
x.cFS.Store(inFS)
return nil
}