mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Close connection on network timeout.
This commit is contained in:
8
error.go
8
error.go
@ -33,15 +33,17 @@ func isNetworkError(err error) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
func isBadConn(err error) bool {
|
||||
func isBadConn(err error, allowTimeout bool) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if _, ok := err.(redisError); ok {
|
||||
return false
|
||||
}
|
||||
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
|
||||
return false
|
||||
if allowTimeout {
|
||||
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user