1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-01 16:06:54 +03:00

Reuse connections to Redis during tests.

This commit is contained in:
Vladimir Mihailenco
2012-08-19 23:59:52 +03:00
parent a654224ced
commit 9764065750
3 changed files with 61 additions and 23 deletions

View File

@ -41,13 +41,18 @@ func (c *PubSubClient) consumeMessages(conn *Conn) {
for {
msg := &Message{}
replyI, err := req.ParseReply(conn.Rd)
replyIface, err := req.ParseReply(conn.Rd)
if err != nil {
msg.Err = err
c.ch <- msg
break
}
reply := replyI.([]interface{})
reply, ok := replyIface.([]interface{})
if !ok {
msg.Err = fmt.Errorf("redis: unexpected reply type %T", replyIface)
c.ch <- msg
return
}
msgName := reply[0].(string)
switch msgName {