You've already forked node-redis
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:
committed by
GitHub
parent
8d37c115e6
commit
d4f194352f
@@ -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,
|
||||
}]
|
||||
);
|
||||
});
|
||||
|
@@ -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]
|
||||
}));
|
||||
}
|
||||
|
Reference in New Issue
Block a user