remote: Fetch into temp files
This commit is contained in:
parent
ff9ffddd57
commit
94e20ffee5
@ -150,12 +150,18 @@ func (r *Remote) acquireFromRemote(ctx context.Context, s abi.SectorID, spt abi.
|
||||
// TODO: see what we have local, prefer that
|
||||
|
||||
for _, url := range info.URLs {
|
||||
err := r.fetch(ctx, url, dest)
|
||||
tempDest := dest + ".fetch"
|
||||
|
||||
err := r.fetch(ctx, url, tempDest)
|
||||
if err != nil {
|
||||
merr = multierror.Append(merr, xerrors.Errorf("fetch error %s (storage %s) -> %s: %w", url, info.ID, dest, err))
|
||||
merr = multierror.Append(merr, xerrors.Errorf("fetch error %s (storage %s) -> %s: %w", url, info.ID, tempDest, err))
|
||||
continue
|
||||
}
|
||||
|
||||
if err := move(tempDest, dest); err != nil {
|
||||
return "", "", "", xerrors.Errorf("fetch move error (storage %s) %s -> %s: %w", info.ID, tempDest, dest, err)
|
||||
}
|
||||
|
||||
if merr != nil {
|
||||
log.Warnw("acquireFromRemote encountered errors when fetching sector from remote", "errors", merr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user