Merge pull request #1085 from filecoin-project/fix/worker-cleanup-sealed

worker: Cleanup sealed sector data in commit
This commit is contained in:
Łukasz Magiera 2020-01-15 02:29:14 +01:00 committed by GitHub
commit 66f707c243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -127,6 +127,10 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
if err := w.push("cache", task.SectorID); err != nil {
return errRes(xerrors.Errorf("pushing precommited data: %w", err))
}
if err := w.remove("sealed", task.SectorID); err != nil {
return errRes(xerrors.Errorf("cleaning up sealed sector: %w", err))
}
}
return res

View File

@ -125,6 +125,11 @@ func (w *worker) push(typ string, sectorID uint64) error {
}
// TODO: keep files around for later stages of sealing
return w.remove(typ, sectorID)
}
func (w *worker) remove(typ string, sectorID uint64) error {
filename := filepath.Join(w.repo, typ, w.sb.SectorName(sectorID))
return os.RemoveAll(filename)
}