Skip to content

Commit

Permalink
remove old cache before SealPreCommitPhase2
Browse files Browse the repository at this point in the history
  • Loading branch information
codefather-filestar committed Jun 22, 2021
1 parent 09b5b89 commit 6193a60
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions extern/sector-storage/ffiwrapper/sealer_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"math/bits"
"os"
"path/filepath"
"runtime"

"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -480,6 +482,18 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
}
defer done()

for _, pattern := range []string{"*-tree-r-*", "*-tree-c-*"} {
files, err := filepath.Glob(fmt.Sprintf("%s/%s", paths.Cache, pattern))
if err != nil {
return storage.SectorCids{}, xerrors.Errorf("glob %s: %w", pattern, err)
}
for _, f := range files {
if err := os.Remove(f); err != nil {
return storage.SectorCids{}, xerrors.Errorf("remove %s: %w", f, err)
}
}
}

sealedCID, unsealedCID, err := ffi.SealPreCommitPhase2(phase1Out, paths.Cache, paths.Sealed)
if err != nil {
return storage.SectorCids{}, xerrors.Errorf("presealing sector %d (%s): %w", sector.ID.Number, paths.Unsealed, err)
Expand Down

0 comments on commit 6193a60

Please sign in to comment.