1
0
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:
Vladimir Mihailenco
2016-03-01 12:31:06 +02:00
parent 0382d1e980
commit 110e93a8e4
10 changed files with 140 additions and 90 deletions

View File

@ -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
}