1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Merge branch 'master' of github.com:redis/node-redis into v5

This commit is contained in:
Leibale
2023-06-19 18:11:46 -04:00
31 changed files with 620 additions and 49 deletions

View File

@@ -24,9 +24,5 @@ describe('LATENCY GRAPH', () => {
typeof await client.latencyGraph('command'),
'string'
);
}, {
serverArguments: testUtils.isVersionGreaterThan([7]) ?
['--enable-debug-command', 'yes'] :
GLOBAL.SERVERS.OPEN.serverArguments
});
}, GLOBAL.SERVERS.OPEN);
});

View File

@@ -0,0 +1,27 @@
import {strict as assert} from 'assert';
import testUtils, {GLOBAL} from '../test-utils';
import { transformArguments } from './LATENCY_LATEST';
describe('LATENCY LATEST', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments(),
['LATENCY', 'LATEST']
);
});
testUtils.testWithClient('client.latencyLatest', async client => {
await Promise.all([
client.configSet('latency-monitor-threshold', '100'),
client.sendCommand(['DEBUG', 'SLEEP', '1'])
]);
const latency = await client.latencyLatest();
assert.ok(Array.isArray(latency));
for (const [name, timestamp, latestLatency, allTimeLatency] of latency) {
assert.equal(typeof name, 'string');
assert.equal(typeof timestamp, 'number');
assert.equal(typeof latestLatency, 'number');
assert.equal(typeof allTimeLatency, 'number');
}
}, GLOBAL.SERVERS.OPEN);
});

View File

@@ -0,0 +1,12 @@
import { RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['LATENCY', 'LATEST'];
}
export declare function transformReply(): Array<[
name: string,
timestamp: number,
latestLatency: number,
allTimeLatency: number
]>;

View File

@@ -13,17 +13,19 @@
// 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 @@
// 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]
// }));
// }