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:
8
multi.go
8
multi.go
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user