fix(#1943): xInfoConsumer.Idle should be time.Duration instead of int64 (#2052)

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
Monkey 2022-03-19 18:22:12 +08:00 committed by GitHub
parent 335d946cd6
commit 997ab5e7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1857,7 +1857,7 @@ type XInfoConsumersCmd struct {
type XInfoConsumer struct {
Name string
Pending int64
Idle int64
Idle time.Duration
}
var _ Cmder = (*XInfoConsumersCmd)(nil)
@ -1906,19 +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":
cmd.val[i].Idle, err = rd.ReadInt()
idle, err = rd.ReadInt()
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
}
}