1
0
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:
Nedyalko Dyakov
2025-05-14 10:06:18 +03:00
parent 8b51596d19
commit b80969f573

View File

@ -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) }
} }
} }
} }