mirror of https://github.com/go-redis/redis.git
Remove releaseConnStrict
This commit is contained in:
parent
2927e15b6b
commit
48224a399f
|
@ -1075,7 +1075,7 @@ func (c *ClusterClient) _processPipeline(ctx context.Context, cmds []Cmder) erro
|
|||
}
|
||||
|
||||
err = c.pipelineProcessCmds(ctx, node, cn, cmds, failedCmds)
|
||||
node.Client.releaseConnStrict(cn, err)
|
||||
node.Client.releaseConn(cn, err)
|
||||
}(node, cmds)
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ func (c *ClusterClient) _processTxPipeline(ctx context.Context, cmds []Cmder) er
|
|||
}
|
||||
|
||||
err = c.txPipelineProcessCmds(ctx, node, cn, cmds, failedCmds)
|
||||
node.Client.releaseConnStrict(cn, err)
|
||||
node.Client.releaseConn(cn, err)
|
||||
}(node, cmds)
|
||||
}
|
||||
|
||||
|
|
7
error.go
7
error.go
|
@ -45,12 +45,13 @@ func isRedisError(err error) bool {
|
|||
}
|
||||
|
||||
func isBadConn(err error, allowTimeout bool) bool {
|
||||
switch err {
|
||||
case nil:
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if isRedisError(err) {
|
||||
return isReadOnlyError(err) // #790
|
||||
// Close connections in read only state in case domain addr is used
|
||||
// and domain resolves to a different Redis Server. See #790.
|
||||
return isReadOnlyError(err)
|
||||
}
|
||||
if allowTimeout {
|
||||
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
|
||||
|
|
14
redis.go
14
redis.go
|
@ -235,18 +235,6 @@ func (c *baseClient) releaseConn(cn *pool.Conn, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *baseClient) releaseConnStrict(cn *pool.Conn, err error) {
|
||||
if c.limiter != nil {
|
||||
c.limiter.ReportResult(err)
|
||||
}
|
||||
|
||||
if err == nil || isRedisError(err) {
|
||||
c.connPool.Put(cn)
|
||||
} else {
|
||||
c.connPool.Remove(cn, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *baseClient) process(ctx context.Context, cmd Cmder) error {
|
||||
for attempt := 0; attempt <= c.opt.MaxRetries; attempt++ {
|
||||
if attempt > 0 {
|
||||
|
@ -351,7 +339,7 @@ func (c *baseClient) generalProcessPipeline(
|
|||
}
|
||||
|
||||
canRetry, err := p(ctx, cn, cmds)
|
||||
c.releaseConnStrict(cn, err)
|
||||
c.releaseConn(cn, err)
|
||||
|
||||
if !canRetry || !isRetryableError(err, true) {
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue