b2: reauth the account while doing uploads too #825
Originally it was thought the upload URL expiring would provide 401 errors so it was excluded from reauth when doing uploads, but on re-reading the docs and looking at this issue it seems that 401 errors are only caused by the account token expiring and not the upload token expiring. We will refresh both the upload token and account token on a 401 error while uploading, and just the account token when we get a 401 at any other time.
This commit is contained in:
parent
34e7ca90fc
commit
4105da206a
2 changed files with 2 additions and 2 deletions
2
b2/b2.go
2
b2/b2.go
|
@ -1368,7 +1368,7 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo) (err error) {
|
|||
// Don't retry, return a retry error instead
|
||||
err = o.fs.pacer.CallNoRetry(func() (bool, error) {
|
||||
resp, err := o.fs.srv.CallJSON(&opts, nil, &response)
|
||||
retry, err := o.fs.shouldRetryNoReauth(resp, err)
|
||||
retry, err := o.fs.shouldRetry(resp, err)
|
||||
// On retryable error clear UploadURL
|
||||
if retry {
|
||||
fs.Debug(o, "Clearing upload URL because of error: %v", err)
|
||||
|
|
|
@ -178,7 +178,7 @@ func (up *largeUpload) transferChunk(part int64, body []byte) error {
|
|||
var response api.UploadPartResponse
|
||||
|
||||
resp, err := up.f.srv.CallJSON(&opts, nil, &response)
|
||||
retry, err := up.f.shouldRetryNoReauth(resp, err)
|
||||
retry, err := up.f.shouldRetry(resp, err)
|
||||
// On retryable error clear PartUploadURL
|
||||
if retry {
|
||||
fs.Debug(up.o, "Clearing part upload URL because of error: %v", err)
|
||||
|
|
Loading…
Reference in a new issue