1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/client/lib/commands/XINFO_CONSUMERS.ts
Codrin-Mihai Chira d4f194352f 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>
2023-05-21 08:06:46 -04:00

29 lines
685 B
TypeScript

import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 2;
export const IS_READ_ONLY = true;
export function transformArguments(
key: RedisCommandArgument,
group: RedisCommandArgument
): RedisCommandArguments {
return ['XINFO', 'CONSUMERS', key, group];
}
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],
inactive: consumer[7]
}));
}