internal: retry timeout

This commit is contained in:
Vladimir Mihailenco 2018-08-23 16:13:42 +03:00
parent 655336673b
commit 8d3747808e
1 changed files with 9 additions and 11 deletions

View File

@ -8,9 +8,15 @@ import (
"github.com/go-redis/redis/internal/proto"
)
func IsRetryableError(err error, retryNetError bool) bool {
if IsNetworkError(err) {
return retryNetError
func IsRetryableError(err error, retryTimeout bool) bool {
if err == io.EOF {
return true
}
if netErr, ok := err.(net.Error); ok {
if netErr.Timeout() {
return retryTimeout
}
return true
}
s := err.Error()
if s == "ERR max number of clients reached" {
@ -33,14 +39,6 @@ func IsRedisError(err error) bool {
return ok
}
func IsNetworkError(err error) bool {
if err == io.EOF {
return true
}
_, ok := err.(net.Error)
return ok
}
func IsBadConn(err error, allowTimeout bool) bool {
if err == nil {
return false