1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Retry BadConnError

This commit is contained in:
Vladimir Mihailenco
2019-08-08 10:36:13 +03:00
parent 056ad27792
commit 2927e15b6b
9 changed files with 61 additions and 37 deletions

View File

@ -171,7 +171,10 @@ func (c *baseClient) _getConn(ctx context.Context) (*pool.Conn, error) {
err = c.initConn(ctx, cn)
if err != nil {
c.connPool.Remove(cn)
c.connPool.Remove(cn, err)
if err := internal.Unwrap(err); err != nil {
return nil, err
}
return nil, err
}
@ -226,7 +229,7 @@ func (c *baseClient) releaseConn(cn *pool.Conn, err error) {
}
if isBadConn(err, false) {
c.connPool.Remove(cn)
c.connPool.Remove(cn, err)
} else {
c.connPool.Put(cn)
}
@ -240,7 +243,7 @@ func (c *baseClient) releaseConnStrict(cn *pool.Conn, err error) {
if err == nil || isRedisError(err) {
c.connPool.Put(cn)
} else {
c.connPool.Remove(cn)
c.connPool.Remove(cn, err)
}
}