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