mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 18:31:10 +08:00
adds logging during failure condition for low-level-retry
This commit is contained in:
parent
b5e72e2fc3
commit
79d82fc841
@ -400,7 +400,18 @@ func (f *Fs) shouldRetry(ctx context.Context, resp *http.Response, err error) (b
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
return f.shouldRetryNoReauth(ctx, resp, err)
|
||||
shouldRetry, err := f.shouldRetryNoReauth(ctx, resp, err)
|
||||
if !shouldRetry && resp != nil {
|
||||
// Log details when not retrying to help with debugging
|
||||
var peek []byte
|
||||
if resp.Body != nil {
|
||||
peek, _ = io.ReadAll(io.LimitReader(resp.Body, 50))
|
||||
_ = resp.Body.Close()
|
||||
}
|
||||
fs.Debugf(f, "Not retrying HTTP response: status=%d headers=%v body=%q",
|
||||
resp.StatusCode, resp.Header, string(peek))
|
||||
}
|
||||
return shouldRetry, err
|
||||
}
|
||||
|
||||
// errorHandler parses a non 2xx error response into an error
|
||||
|
Loading…
x
Reference in New Issue
Block a user