Skip to content

Commit 997ab5e

Browse files
authored
fix(#1943): xInfoConsumer.Idle should be time.Duration instead of int64 (#2052)
Signed-off-by: monkey92t <[email protected]>
1 parent 335d946 commit 997ab5e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

command.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ type XInfoConsumersCmd struct {
18571857
type XInfoConsumer struct {
18581858
Name string
18591859
Pending int64
1860-
Idle int64
1860+
Idle time.Duration
18611861
}
18621862

18631863
var _ Cmder = (*XInfoConsumersCmd)(nil)
@@ -1906,19 +1906,21 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
19061906
return err
19071907
}
19081908

1909+
var idle int64
19091910
switch key {
19101911
case "name":
19111912
cmd.val[i].Name, err = rd.ReadString()
19121913
case "pending":
19131914
cmd.val[i].Pending, err = rd.ReadInt()
19141915
case "idle":
1915-
cmd.val[i].Idle, err = rd.ReadInt()
1916+
idle, err = rd.ReadInt()
19161917
default:
19171918
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
19181919
}
19191920
if err != nil {
19201921
return err
19211922
}
1923+
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
19221924
}
19231925
}
19241926

0 commit comments

Comments
 (0)