Skip to content

Commit

Permalink
fix: add XInfoConsumers test
Browse files Browse the repository at this point in the history
Signed-off-by: monkey92t <[email protected]>
  • Loading branch information
monkey92t committed Mar 19, 2022
1 parent 997ab5e commit 6f1a1ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1906,21 +1906,21 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
return err
}

var idle int64
switch key {
case "name":
cmd.val[i].Name, err = rd.ReadString()
case "pending":
cmd.val[i].Pending, err = rd.ReadInt()
case "idle":
var idle int64
idle, err = rd.ReadInt()
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
default:
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
}
if err != nil {
return err
}
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
}
}

Expand Down
1 change: 1 addition & 0 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5008,6 +5008,7 @@ var _ = Describe("Commands", func() {
res, err := client.XInfoConsumers(ctx, "stream", "group1").Result()
Expect(err).NotTo(HaveOccurred())
for i := range res {
Expect(res[i].Idle > 0).To(BeTrue())
res[i].Idle = 0
}
Expect(res).To(Equal([]redis.XInfoConsumer{
Expand Down

0 comments on commit 6f1a1ac

Please sign in to comment.