1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

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

View File

@ -1857,7 +1857,7 @@ type XInfoConsumersCmd struct {
type XInfoConsumer struct { type XInfoConsumer struct {
Name string Name string
Pending int64 Pending int64
Idle int64 Idle time.Duration
} }
var _ Cmder = (*XInfoConsumersCmd)(nil) var _ Cmder = (*XInfoConsumersCmd)(nil)
@ -1906,19 +1906,21 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
return err return err
} }
var idle int64
switch key { switch key {
case "name": case "name":
cmd.val[i].Name, err = rd.ReadString() cmd.val[i].Name, err = rd.ReadString()
case "pending": case "pending":
cmd.val[i].Pending, err = rd.ReadInt() cmd.val[i].Pending, err = rd.ReadInt()
case "idle": case "idle":
cmd.val[i].Idle, err = rd.ReadInt() idle, err = rd.ReadInt()
default: default:
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key) return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
} }
if err != nil { if err != nil {
return err return err
} }
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
} }
} }