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

multi: Properly reset client in case of empty transaction.

This commit is contained in:
Vladimir Mihailenco
2012-08-25 21:54:35 +03:00
parent 4e3743c0d6
commit ee844aaf1d
2 changed files with 21 additions and 3 deletions

View File

@@ -53,12 +53,14 @@ func (c *MultiClient) Exec(do func()) ([]Req, error) {
c.mtx.Lock()
c.reqs = append(c.reqs, NewIfaceSliceReq("EXEC"))
if len(c.reqs) == 2 {
reqs := c.reqs
c.reqs = nil
if len(reqs) == 2 {
c.mtx.Unlock()
return []Req{}, nil
}
reqs := c.reqs
c.reqs = nil
c.mtx.Unlock()
conn, err := c.conn()