mirror of
https://github.com/redis/go-redis.git
synced 2025-07-16 13:21:51 +03:00
xinfo-groups: support nil lag in XINFO GROUPS (#3369)
* xinfo-groups: support nil lag in XINFO GROUPS * Add test * docs: clarify XInfoGroup.Lag field behavior with Nil values * docs: clarify XInfoGroup.Lag field behavior
This commit is contained in:
@ -2104,7 +2104,9 @@ type XInfoGroup struct {
|
||||
Pending int64
|
||||
LastDeliveredID string
|
||||
EntriesRead int64
|
||||
Lag int64
|
||||
// Lag represents the number of pending messages in the stream not yet
|
||||
// delivered to this consumer group. Returns -1 when the lag cannot be determined.
|
||||
Lag int64
|
||||
}
|
||||
|
||||
var _ Cmder = (*XInfoGroupsCmd)(nil)
|
||||
@ -2187,8 +2189,11 @@ func (cmd *XInfoGroupsCmd) readReply(rd *proto.Reader) error {
|
||||
|
||||
// lag: the number of entries in the stream that are still waiting to be delivered
|
||||
// to the group's consumers, or a NULL(Nil) when that number can't be determined.
|
||||
// In that case, we return -1.
|
||||
if err != nil && err != Nil {
|
||||
return err
|
||||
} else if err == Nil {
|
||||
group.Lag = -1
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("redis: unexpected key %q in XINFO GROUPS reply", key)
|
||||
|
Reference in New Issue
Block a user