mirror of
https://github.com/redis/go-redis.git
synced 2025-07-20 22:42:59 +03:00
fix(auth): don't double close the conn
This commit is contained in:
10
redis.go
10
redis.go
@ -317,11 +317,11 @@ func (c *baseClient) onAuthenticationErr(ctx context.Context, cn *Conn) func(err
|
|||||||
poolCn, getErr := cn.connPool.Get(ctx)
|
poolCn, getErr := cn.connPool.Get(ctx)
|
||||||
if getErr == nil {
|
if getErr == nil {
|
||||||
c.connPool.Remove(ctx, poolCn, err)
|
c.connPool.Remove(ctx, poolCn, err)
|
||||||
}
|
} else {
|
||||||
|
// if we can't get the pool connection, we can only close the connection
|
||||||
// if we can't get the pool connection, we can only close the connection
|
if err := cn.Close(); err != nil {
|
||||||
if err := cn.Close(); err != nil {
|
log.Printf("failed to close connection: %v", err)
|
||||||
log.Printf("failed to close connection: %v", err)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user