Skip to content

Commit

Permalink
fix: storage: Remove temp fetching files after failed fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Apr 13, 2023
1 parent a7379e2 commit 7a4f697
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions storage/paths/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ func (r *Remote) acquireFromRemote(ctx context.Context, s abi.SectorID, fileType
err = r.fetchThrottled(ctx, url, tempDest)
if err != nil {
merr = multierror.Append(merr, xerrors.Errorf("fetch error %s (storage %s) -> %s: %w", url, info.ID, tempDest, err))
// fetching failed, remove temp file
if rerr := os.RemoveAll(tempDest); rerr != nil {
merr = multierror.Append(merr, xerrors.Errorf("removing temp dest (post-err cleanup): %w", rerr))
}
continue
}

Expand Down

0 comments on commit 7a4f697

Please sign in to comment.