Skip to content

Commit

Permalink
XINFO CONSUMERS - add support for the inactive field (#2490)
Browse files Browse the repository at this point in the history
* Support XINFO CONSUMERS: Added the inactive field

* Update XINFO_CONSUMERS.ts

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
  • Loading branch information
codrin-ch and leibale authored May 21, 2023
1 parent 8d37c11 commit d4f1943
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/client/lib/commands/XINFO_CONSUMERS.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ describe('XINFO CONSUMERS', () => {
it('transformReply', () => {
assert.deepEqual(
transformReply([
['name', 'Alice', 'pending', 1, 'idle', 9104628],
['name', 'Bob', 'pending', 1, 'idle', 83841983]
['name', 'Alice', 'pending', 1, 'idle', 9104628, 'inactive', 9281221],
['name', 'Bob', 'pending', 1, 'idle', 83841983, 'inactive', 7213871]
]),
[{
name: 'Alice',
pending: 1,
idle: 9104628
idle: 9104628,
inactive: 9281221,
}, {
name: 'Bob',
pending: 1,
idle: 83841983
idle: 83841983,
inactive: 7213871,
}]
);
});
Expand Down
4 changes: 3 additions & 1 deletion packages/client/lib/commands/XINFO_CONSUMERS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ type XInfoConsumersReply = Array<{
name: RedisCommandArgument;
pending: number;
idle: number;
inactive: number;
}>;

export function transformReply(rawReply: Array<any>): XInfoConsumersReply {
return rawReply.map(consumer => ({
name: consumer[1],
pending: consumer[3],
idle: consumer[5]
idle: consumer[5],
inactive: consumer[7]
}));
}

0 comments on commit d4f1943

Please sign in to comment.