mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Simplify connection management with sticky connection pool. Fixes #260.
This commit is contained in:
14
multi.go
14
multi.go
@ -45,18 +45,6 @@ func (c *Client) Multi() *Multi {
|
||||
return multi
|
||||
}
|
||||
|
||||
func (c *Multi) putConn(cn *conn, err error) {
|
||||
if isBadConn(cn, err) {
|
||||
// Close current connection.
|
||||
c.base.connPool.(*stickyConnPool).Reset(err)
|
||||
} else {
|
||||
err := c.base.connPool.Put(cn)
|
||||
if err != nil {
|
||||
Logger.Printf("pool.Put failed: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Multi) process(cmd Cmder) {
|
||||
if c.cmds == nil {
|
||||
c.base.process(cmd)
|
||||
@ -145,7 +133,7 @@ func (c *Multi) Exec(f func() error) ([]Cmder, error) {
|
||||
}
|
||||
|
||||
err = c.execCmds(cn, cmds)
|
||||
c.putConn(cn, err)
|
||||
c.base.putConn(cn, err)
|
||||
return retCmds, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user