mirror of
https://github.com/rclone/rclone.git
synced 2025-01-11 08:49:37 +01:00
Make IsRetryError function
This commit is contained in:
parent
2db35f0ce7
commit
ac9c20b048
@ -58,6 +58,15 @@ func RetryError(err error) error {
|
|||||||
return plainRetryError{err}
|
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
|
// isClosedConnError reports whether err is an error from use of a closed
|
||||||
// network connection.
|
// network connection.
|
||||||
//
|
//
|
||||||
|
@ -238,7 +238,7 @@ tryAgain:
|
|||||||
inErr = in.Close()
|
inErr = in.Close()
|
||||||
}
|
}
|
||||||
// Retry if err returned a retry error
|
// Retry if err returned a retry error
|
||||||
if r, ok := err.(Retry); ok && r.Retry() && tries < maxTries {
|
if IsRetryError(err) && tries < maxTries {
|
||||||
tries++
|
tries++
|
||||||
Log(src, "Received error: %v - low level retry %d/%d", err, tries, maxTries)
|
Log(src, "Received error: %v - low level retry %d/%d", err, tries, maxTries)
|
||||||
if removeFailedCopy(dst) {
|
if removeFailedCopy(dst) {
|
||||||
|
Loading…
Reference in New Issue
Block a user