Make IsRetryError function
This commit is contained in:
parent
2db35f0ce7
commit
ac9c20b048
2 changed files with 10 additions and 1 deletions
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue