1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-15 12:41:41 +03:00

pool: put connection to the list before returning it.

This commit is contained in:
Vladimir Mihailenco
2015-06-03 16:45:46 +03:00
parent 3fc16811b5
commit a8fe55571b
4 changed files with 55 additions and 28 deletions

View File

@ -3,6 +3,7 @@ package redis
import (
"errors"
"fmt"
"log"
)
var errDiscard = errors.New("redis: Discard can be used only inside Exec")
@ -18,7 +19,10 @@ type Multi struct {
func (c *Client) Multi() *Multi {
multi := &Multi{
base: &baseClient{opt: c.opt, connPool: newSingleConnPool(c.connPool, true)},
base: &baseClient{
opt: c.opt,
connPool: newSingleConnPool(c.connPool, true),
},
}
multi.commandable.process = multi.process
return multi
@ -34,7 +38,7 @@ func (c *Multi) process(cmd Cmder) {
func (c *Multi) Close() error {
if err := c.Unwatch().Err(); err != nil {
return err
log.Printf("redis: Unwatch failed: %s", err)
}
return c.base.Close()
}