compact hotstore if it provides the method

This commit is contained in:
vyzo 2021-03-11 11:45:19 +02:00
parent 01ce9b5c44
commit 353bb1881f

View File

@ -798,6 +798,18 @@ func (s *SplitStore) purgeTracking(cids []cid.Cid) error {
}
func (s *SplitStore) gcHotstore() {
if compact, ok := s.hot.(interface{ Compact() error }); ok {
log.Infof("compacting hotstore")
startCompact := time.Now()
err := compact.Compact()
if err != nil {
log.Warnf("error compacting hotstore: %s", err)
return
} else {
log.Infow("hotstore compaction done", "took", time.Since(startCompact))
}
}
if gc, ok := s.hot.(interface{ CollectGarbage() error }); ok {
log.Infof("garbage collecting hotstore")
startGC := time.Now()