diff --git a/backend/hubic/auth.go b/backend/hubic/auth.go index c437d31ce..08469acb6 100644 --- a/backend/hubic/auth.go +++ b/backend/hubic/auth.go @@ -2,7 +2,9 @@ package hubic import ( "net/http" + "time" + "github.com/ncw/rclone/fs" "github.com/ncw/swift" ) @@ -21,12 +23,17 @@ func newAuth(f *Fs) *auth { // Request constructs a http.Request for authentication // // returns nil for not needed -func (a *auth) Request(*swift.Connection) (*http.Request, error) { - err := a.f.getCredentials() - if err != nil { - return nil, err +func (a *auth) Request(*swift.Connection) (r *http.Request, err error) { + const retries = 10 + for try := 1; try <= retries; try++ { + err = a.f.getCredentials() + if err == nil { + break + } + time.Sleep(100 * time.Millisecond) + fs.Debugf(a.f, "retrying auth request %d/%d: %v", try, retries, err) } - return nil, nil + return nil, err } // Response parses the result of an http request