Skip to content

Commit b80969f

Browse files
committed
fix(auth): don't double close the conn
1 parent 8b51596 commit b80969f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

redis.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ func (c *baseClient) onAuthenticationErr(ctx context.Context, cn *Conn) func(err
317317
poolCn, getErr := cn.connPool.Get(ctx)
318318
if getErr == nil {
319319
c.connPool.Remove(ctx, poolCn, err)
320-
}
321-
322-
// if we can't get the pool connection, we can only close the connection
323-
if err := cn.Close(); err != nil {
324-
log.Printf("failed to close connection: %v", err)
320+
} else {
321+
// if we can't get the pool connection, we can only close the connection
322+
if err := cn.Close(); err != nil {
323+
log.Printf("failed to close connection: %v", err)
324+
}
325325
}
326326
}
327327
}

0 commit comments

Comments
 (0)