This commit is contained in:
Łukasz Magiera 2024-02-22 11:39:17 +01:00
parent a586982c2a
commit 0634dfce07
2 changed files with 9 additions and 6 deletions

View File

@ -315,7 +315,9 @@ func Test32G(t *testing.T) {
// dump tree.dat
datFile, err := os.Open(tempFile)
require.NoError(t, err)
defer datFile.Close()
defer func() {
require.NoError(t, datFile.Close())
}()
actualD := hexPrint32LDedup(bufio.NewReaderSize(datFile, 1<<20))
fmt.Println(actualD)

View File

@ -430,13 +430,14 @@ func (r *Remote) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er
}
_ = resp.Body.Close()
return out, nil // Successfully decoded, return the result
} else {
}
// non-200 status code
b, _ := io.ReadAll(resp.Body) // Best-effort read the body for logging
log.Warnw("request to endpoint failed", "url", rl.String(), "statusCode", resp.StatusCode, "response", string(b))
_ = resp.Body.Close()
// Continue to try the next URL, don't return here as we want to try all URLs
}
}
return fsutil.FsStat{}, xerrors.Errorf("all endpoints failed for remote storage %s", id)
}