"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Fixes #1788: Retry-After support for Dropbox backend
Mathieu Carbou8fb707e16dab
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.goindex d6b18fdcf..e4ad4ba79 100644--- a/backend/dropbox/dropbox.go+++ b/backend/dropbox/dropbox.go@@ -31,6 +31,7 @@ import ("time""github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth""github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common""github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files""github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing"@@ -203,7 +204,16 @@ func shouldRetry(err error) (bool, error) {return false, err}baseErrString := errors.Cause(err).Error()- // FIXME there is probably a better way of doing this!+ // handle any official Retry-After header from Dropbox's SDK first+ switch e := err.(type) {+ case auth.RateLimitAPIError:+ if e.RateLimitError.RetryAfter > 0 {+ fs.Debugf(baseErrString, "Too many requests or write operations. Trying again in %d seconds.", e.RateLimitError.RetryAfter)+ time.Sleep(time.Duration(e.RateLimitError.RetryAfter) * time.Second)+ }+ return true, err+ }+ // Keep old behaviour for backward compatibilityif strings.Contains(baseErrString, "too_many_write_operations") || strings.Contains(baseErrString, "too_many_requests") {return true, err}