1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Close the conn on context timeout

This commit is contained in:
Vladimir Mihailenco
2020-12-06 11:05:42 +02:00
parent 43d9b98d48
commit 02ccf05ed0
4 changed files with 50 additions and 21 deletions

View File

@ -65,8 +65,11 @@ func isRedisError(err error) bool {
}
func isBadConn(err error, allowTimeout bool) bool {
if err == nil {
switch err {
case nil:
return false
case context.Canceled, context.DeadlineExceeded:
return true
}
if isRedisError(err) {