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
|
||||
}
|
||||
|
||||
msgs := make([]XMessage, n)
|
||||
for i := 0; i < len(msgs); i++ {
|
||||
if msgs[i], err = readXMessage(rd); err != nil {
|
||||
return nil, err
|
||||
msgs := make([]XMessage, 0, n)
|
||||
for i := 0; i < n; i++ {
|
||||
if xMessage, err := readXMessage(rd); err == nil {
|
||||
msgs = append(msgs, xMessage)
|
||||
}
|
||||
}
|
||||
if len(msgs) < 1 {
|
||||
// Compatible with previous returns
|
||||
return nil, proto.Nil
|
||||
}
|
||||
return msgs, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -5691,7 +5691,7 @@ var _ = Describe("Commands", func() {
|
|||
Stream: "stream",
|
||||
Group: "group",
|
||||
Consumer: "consumer",
|
||||
Messages: []string{"1-0", "2-0", "3-0"},
|
||||
Messages: []string{"???-???", "1-0", "2-0", "3-0"},
|
||||
}).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(msgs).To(Equal([]redis.XMessage{{
|
||||
|
|
Loading…
Reference in New Issue