From 4105da206a9cc3021cf19cefe984220e7c5d49e9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 7 Nov 2016 13:30:51 +0000 Subject: [PATCH] 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. --- b2/b2.go | 2 +- b2/upload.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/b2/b2.go b/b2/b2.go index a4991a1b5..cffc29950 100644 --- a/b2/b2.go +++ b/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) diff --git a/b2/upload.go b/b2/upload.go index cb43adc70..b9a9ff1fd 100644 --- a/b2/upload.go +++ b/b2/upload.go @@ -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)