1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

XINFO CONSUMERS - add support for the inactive field (#2490)

* Support XINFO CONSUMERS: Added the inactive field

* Update XINFO_CONSUMERS.ts

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
Codrin-Mihai Chira
2023-05-21 15:06:46 +03:00
committed by GitHub
parent 8d37c115e6
commit d4f194352f
2 changed files with 9 additions and 5 deletions

View File

@@ -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,
}]
);
});

View File

@@ -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]
}));
}