"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
Retry if a timeout occurs.
Klaus Postfa870772119c
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex 565e47f80..f8454005c 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -15,7 +15,9 @@ import ("fmt""io""log"+ "net""net/http"+ "net/url""regexp""strings""time"@@ -124,8 +126,7 @@ func parsePath(path string) (root string) {// shouldRetry returns a boolean as to whether this resp and err// deserve to be retried. It returns the err as a conveniencefunc shouldRetry(resp *http.Response, err error) (bool, error) {- // FIXME retry other http codes?- // 409 conflict ?+ // Retry on 429 Rate exceeded.if err != nil && resp != nil && resp.StatusCode == 429 {return true, err}@@ -133,6 +134,18 @@ func shouldRetry(resp *http.Response, err error) (bool, error) {if err != nil && resp != nil && resp.StatusCode == 500 {return true, err}+ // Allow retry if request times out. Adapted from+ // http://stackoverflow.com/questions/23494950/specifically-check-for-timeout-error+ switch err := err.(type) {+ case *url.Error:+ if err, ok := err.Err.(net.Error); ok && err.Timeout() {+ return true, err+ }+ case net.Error:+ if err.Timeout() {+ return true, err+ }+ }return false, err}