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:
4
redis.go
4
redis.go
@ -317,8 +317,7 @@ 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)
|
||||||
@ -327,6 +326,7 @@ func (c *baseClient) onAuthenticationErr(ctx context.Context, cn *Conn) func(err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *baseClient) wrappedOnClose(newOnClose func() error) func() error {
|
func (c *baseClient) wrappedOnClose(newOnClose func() error) func() error {
|
||||||
onClose := c.onClose
|
onClose := c.onClose
|
||||||
|
Reference in New Issue
Block a user