Merge pull request #10661 from filecoin-project/fix/cleanup-temp-failed-fetch

fix: storage: Remove temp fetching files after failed fetch
This commit is contained in:
Łukasz Magiera 2023-04-25 19:28:33 +02:00 committed by GitHub
commit 7e34b49b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}