mirror of https://github.com/go-redis/redis.git
Update command.go
This commit is contained in:
parent
2772a6137f
commit
99cfdfbeac
19
command.go
19
command.go
|
@ -1453,14 +1453,19 @@ func readXMessageSlice(rd *proto.Reader) ([]XMessage, error) {
|
|||
}
|
||||
|
||||
msgs := make([]XMessage, 0, n)
|
||||
for i := 0; i < n; i++ {
|
||||
if xMessage, err := readXMessage(rd); err == nil {
|
||||
msgs = append(msgs, xMessage)
|
||||
if n > 0 {
|
||||
var firstError error
|
||||
for i := 0; i < n; i++ {
|
||||
if xMessage, err := readXMessage(rd); err == nil {
|
||||
msgs = append(msgs, xMessage)
|
||||
} else if firstError == nil {
|
||||
firstError = err
|
||||
}
|
||||
}
|
||||
if len(msgs) < 1 && firstError != nil {
|
||||
// Compatible with previous returns
|
||||
return nil, firstError
|
||||
}
|
||||
}
|
||||
if len(msgs) < 1 {
|
||||
// Compatible with previous returns
|
||||
return nil, Nil
|
||||
}
|
||||
return msgs, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue