Skip to content

Commit bc2c84b

Browse files
committed
fix: continue pruning if version is not found
1 parent 6bb9c64 commit bc2c84b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

nodedb.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ func (ndb *nodeDB) startPruning() {
637637
}
638638

639639
if err := ndb.deleteVersionsTo(toVersion); err != nil {
640-
ndb.logger.Error("Error while pruning", "err", err)
641-
time.Sleep(1 * time.Second)
640+
ndb.logger.Error("Error while pruning full store asynchronously", "version to prune to", toVersion, "err", err)
641+
time.Sleep(500 * time.Millisecond)
642642
continue
643643
}
644644

@@ -711,7 +711,12 @@ func (ndb *nodeDB) deleteVersionsTo(toVersion int64) error {
711711
rootkeyCache := &rootkeyCache{}
712712
for version := first; version <= toVersion; version++ {
713713
if err := ndb.deleteVersion(version, rootkeyCache); err != nil {
714-
return err
714+
// If the version is not found in the store continue on to the next version available
715+
if err != ErrVersionDoesNotExist {
716+
return err
717+
}
718+
719+
ndb.logger.Error("Error while pruning, moving on the the next version in the store", "version missing", version, "next version", version+1, "err", err)
715720
}
716721
ndb.resetFirstVersion(version + 1)
717722
}

0 commit comments

Comments
 (0)