mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
fix(conn): releaseConn should be executed correctly
Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
11
redis.go
11
redis.go
@ -342,9 +342,14 @@ func (c *baseClient) withConn(
|
||||
return err
|
||||
}
|
||||
|
||||
err = fn(ctx, cn)
|
||||
c.releaseConn(ctx, cn, err)
|
||||
return err
|
||||
var fnErr error
|
||||
defer func() {
|
||||
c.releaseConn(ctx, cn, fnErr)
|
||||
}()
|
||||
|
||||
fnErr = fn(ctx, cn)
|
||||
|
||||
return fnErr
|
||||
}
|
||||
|
||||
func (c *baseClient) dial(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
|
Reference in New Issue
Block a user