You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
* fix #1912 - CLIENT PAUSE * fix client pause * Update commands.ts
This commit is contained in:
@@ -22,6 +22,7 @@ import * as CLIENT_GETREDIR from '../commands/CLIENT_GETREDIR';
|
|||||||
import * as CLIENT_ID from '../commands/CLIENT_ID';
|
import * as CLIENT_ID from '../commands/CLIENT_ID';
|
||||||
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
|
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
|
||||||
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
|
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
|
||||||
|
import * as CLIENT_PAUSE from '../commands/CLIENT_PAUSE';
|
||||||
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
|
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
|
||||||
import * as CLIENT_INFO from '../commands/CLIENT_INFO';
|
import * as CLIENT_INFO from '../commands/CLIENT_INFO';
|
||||||
import * as CLUSTER_ADDSLOTS from '../commands/CLUSTER_ADDSLOTS';
|
import * as CLUSTER_ADDSLOTS from '../commands/CLUSTER_ADDSLOTS';
|
||||||
@@ -157,10 +158,12 @@ export default {
|
|||||||
clientId: CLIENT_ID,
|
clientId: CLIENT_ID,
|
||||||
CLIENT_KILL,
|
CLIENT_KILL,
|
||||||
clientKill: CLIENT_KILL,
|
clientKill: CLIENT_KILL,
|
||||||
CLIENT_SETNAME,
|
|
||||||
clientSetName: CLIENT_SETNAME,
|
|
||||||
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
|
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
|
||||||
clientNoEvict: CLIENT_NO_EVICT,
|
clientNoEvict: CLIENT_NO_EVICT,
|
||||||
|
CLIENT_PAUSE,
|
||||||
|
clientPause: CLIENT_PAUSE,
|
||||||
|
CLIENT_SETNAME,
|
||||||
|
clientSetName: CLIENT_SETNAME,
|
||||||
CLIENT_INFO,
|
CLIENT_INFO,
|
||||||
clientInfo: CLIENT_INFO,
|
clientInfo: CLIENT_INFO,
|
||||||
CLUSTER_ADDSLOTS,
|
CLUSTER_ADDSLOTS,
|
||||||
|
28
packages/client/lib/commands/CLIENT_PAUSE.spec.ts
Normal file
28
packages/client/lib/commands/CLIENT_PAUSE.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './CLIENT_PAUSE';
|
||||||
|
|
||||||
|
describe('CLIENT PAUSE', () => {
|
||||||
|
describe('transformArguments', () => {
|
||||||
|
it('simple', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments(0),
|
||||||
|
['CLIENT', 'PAUSE', '0']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('with mode', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments(0, 'ALL'),
|
||||||
|
['CLIENT', 'PAUSE', '0', 'ALL']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.clientPause', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.clientPause(0),
|
||||||
|
'OK'
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
20
packages/client/lib/commands/CLIENT_PAUSE.ts
Normal file
20
packages/client/lib/commands/CLIENT_PAUSE.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export function transformArguments(
|
||||||
|
timeout: number,
|
||||||
|
mode?: 'WRITE' | 'ALL'
|
||||||
|
): RedisCommandArguments {
|
||||||
|
const args = [
|
||||||
|
'CLIENT',
|
||||||
|
'PAUSE',
|
||||||
|
timeout.toString()
|
||||||
|
];
|
||||||
|
|
||||||
|
if (mode) {
|
||||||
|
args.push(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): 'OK' | Buffer;
|
Reference in New Issue
Block a user