mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Don't remove connection from the pool on redis errors.
This commit is contained in:
12
redis.go
12
redis.go
@ -65,12 +65,14 @@ func (c *baseClient) init(cn *conn, password string, db int64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *baseClient) freeConn(cn *conn, err error) {
|
||||
if err == Nil || err == TxFailedErr {
|
||||
c.putConn(cn)
|
||||
} else {
|
||||
c.removeConn(cn)
|
||||
func (c *baseClient) freeConn(cn *conn, ei error) error {
|
||||
if cn.rd.Buffered() > 0 {
|
||||
return c.connPool.Remove(cn)
|
||||
}
|
||||
if _, ok := ei.(redisError); ok {
|
||||
return c.connPool.Put(cn)
|
||||
}
|
||||
return c.connPool.Remove(cn)
|
||||
}
|
||||
|
||||
func (c *baseClient) removeConn(cn *conn) {
|
||||
|
Reference in New Issue
Block a user