Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Make IsRetryError function

Nick Craig-Woodac9c20b04848
diff --git a/fs/error.go b/fs/error.go
index 66d32af18..97c9e2ee3 100644
--- a/fs/error.go
+++ b/fs/error.go
@@ -58,6 +58,15 @@ func RetryError(err error) error {
return plainRetryError{err}
}
+// IsRetryError returns true if err conforms to the Retry interface
+// and calling the Retry method returns true.
+func IsRetryError(err error) bool {
+ if r, ok := err.(Retry); ok {
+ return r.Retry()
+ }
+ return false
+}
+
// isClosedConnError reports whether err is an error from use of a closed
// network connection.
//
diff --git a/fs/operations.go b/fs/operations.go
index 8c9568766..6c4201204 100644
--- a/fs/operations.go
+++ b/fs/operations.go
@@ -238,7 +238,7 @@ tryAgain:
inErr = in.Close()
}
// Retry if err returned a retry error
- if r, ok := err.(Retry); ok && r.Retry() && tries < maxTries {
+ if IsRetryError(err) && tries < maxTries {
tries++
Log(src, "Received error: %v - low level retry %d/%d", err, tries, maxTries)
if removeFailedCopy(dst) {