mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Fix waiting reply on empty queue.
This commit is contained in:
8
redis.go
8
redis.go
@ -131,6 +131,10 @@ func (c *Client) Run(req Req) {
|
||||
}
|
||||
|
||||
func (c *Client) RunQueued() ([]Req, error) {
|
||||
if len(c.reqs) == 0 {
|
||||
return c.reqs, nil
|
||||
}
|
||||
|
||||
c.mtx.Lock()
|
||||
reqs := c.reqs
|
||||
c.reqs = make([]Req, 0)
|
||||
@ -177,6 +181,10 @@ func (c *Client) Discard() {
|
||||
}
|
||||
|
||||
func (c *Client) Exec() ([]Req, error) {
|
||||
if len(c.reqs) == 0 {
|
||||
return c.reqs, nil
|
||||
}
|
||||
|
||||
c.mtx.Lock()
|
||||
reqs := c.reqs
|
||||
c.reqs = make([]Req, 0)
|
||||
|
Reference in New Issue
Block a user