mirror of https://github.com/go-redis/redis.git
Update command.go
This commit is contained in:
parent
fcb3506e79
commit
d5358ff27d
12
command.go
12
command.go
|
@ -1452,12 +1452,16 @@ func readXMessageSlice(rd *proto.Reader) ([]XMessage, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs := make([]XMessage, n)
|
msgs := make([]XMessage, 0, n)
|
||||||
for i := 0; i < len(msgs); i++ {
|
for i := 0; i < n; i++ {
|
||||||
if msgs[i], err = readXMessage(rd); err != nil {
|
if xMessage, err := readXMessage(rd); err == nil {
|
||||||
return nil, err
|
msgs = append(msgs, xMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(msgs) < 1 {
|
||||||
|
// Compatible with previous returns
|
||||||
|
return nil, proto.Nil
|
||||||
|
}
|
||||||
return msgs, nil
|
return msgs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5691,7 +5691,7 @@ var _ = Describe("Commands", func() {
|
||||||
Stream: "stream",
|
Stream: "stream",
|
||||||
Group: "group",
|
Group: "group",
|
||||||
Consumer: "consumer",
|
Consumer: "consumer",
|
||||||
Messages: []string{"1-0", "2-0", "3-0"},
|
Messages: []string{"???-???", "1-0", "2-0", "3-0"},
|
||||||
}).Result()
|
}).Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(msgs).To(Equal([]redis.XMessage{{
|
Expect(msgs).To(Equal([]redis.XMessage{{
|
||||||
|
|
Loading…
Reference in New Issue