mirror of https://github.com/go-redis/redis.git
fix(conn): releaseConn should be executed correctly
Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
parent
805bfc2c60
commit
21e1954745
20
cluster.go
20
cluster.go
|
@ -1287,9 +1287,13 @@ func (c *ClusterClient) processPipelineNode(
|
|||
return err
|
||||
}
|
||||
|
||||
err = c.processPipelineNodeConn(ctx, node, cn, cmds, failedCmds)
|
||||
node.Client.releaseConn(ctx, cn, err)
|
||||
return err
|
||||
var processErr error
|
||||
defer func() {
|
||||
node.Client.releaseConn(ctx, cn, processErr)
|
||||
}()
|
||||
processErr = c.processPipelineNodeConn(ctx, node, cn, cmds, failedCmds)
|
||||
|
||||
return processErr
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1464,9 +1468,13 @@ func (c *ClusterClient) processTxPipelineNode(
|
|||
return err
|
||||
}
|
||||
|
||||
err = c.processTxPipelineNodeConn(ctx, node, cn, cmds, failedCmds)
|
||||
node.Client.releaseConn(ctx, cn, err)
|
||||
return err
|
||||
var processErr error
|
||||
defer func() {
|
||||
node.Client.releaseConn(ctx, cn, processErr)
|
||||
}()
|
||||
processErr = c.processTxPipelineNodeConn(ctx, node, cn, cmds, failedCmds)
|
||||
|
||||
return processErr
|
||||
})
|
||||
}
|
||||
|
||||
|
|
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) {
|
||||
|
|
Loading…
Reference in New Issue