You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +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', () => {
|
it('transformReply', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformReply([
|
transformReply([
|
||||||
['name', 'Alice', 'pending', 1, 'idle', 9104628],
|
['name', 'Alice', 'pending', 1, 'idle', 9104628, 'inactive', 9281221],
|
||||||
['name', 'Bob', 'pending', 1, 'idle', 83841983]
|
['name', 'Bob', 'pending', 1, 'idle', 83841983, 'inactive', 7213871]
|
||||||
]),
|
]),
|
||||||
[{
|
[{
|
||||||
name: 'Alice',
|
name: 'Alice',
|
||||||
pending: 1,
|
pending: 1,
|
||||||
idle: 9104628
|
idle: 9104628,
|
||||||
|
inactive: 9281221,
|
||||||
}, {
|
}, {
|
||||||
name: 'Bob',
|
name: 'Bob',
|
||||||
pending: 1,
|
pending: 1,
|
||||||
idle: 83841983
|
idle: 83841983,
|
||||||
|
inactive: 7213871,
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -15,12 +15,14 @@ type XInfoConsumersReply = Array<{
|
|||||||
name: RedisCommandArgument;
|
name: RedisCommandArgument;
|
||||||
pending: number;
|
pending: number;
|
||||||
idle: number;
|
idle: number;
|
||||||
|
inactive: number;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export function transformReply(rawReply: Array<any>): XInfoConsumersReply {
|
export function transformReply(rawReply: Array<any>): XInfoConsumersReply {
|
||||||
return rawReply.map(consumer => ({
|
return rawReply.map(consumer => ({
|
||||||
name: consumer[1],
|
name: consumer[1],
|
||||||
pending: consumer[3],
|
pending: consumer[3],
|
||||||
idle: consumer[5]
|
idle: consumer[5],
|
||||||
|
inactive: consumer[7]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user