You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix rename command not working together with key prefixes
This commit is contained in:
10
index.js
10
index.js
@@ -794,17 +794,15 @@ RedisClient.prototype.send_command = function (command, args, callback) {
|
|||||||
}
|
}
|
||||||
this.command_queue.push(command_obj);
|
this.command_queue.push(command_obj);
|
||||||
|
|
||||||
if (typeof this.options.rename_commands !== 'undefined' && this.options.rename_commands[command]) {
|
|
||||||
command = this.options.rename_commands[command];
|
|
||||||
}
|
|
||||||
if (this.options.prefix) {
|
if (this.options.prefix) {
|
||||||
prefix_keys = commands.getKeyIndexes(command, args_copy);
|
prefix_keys = commands.getKeyIndexes(command, args_copy);
|
||||||
i = prefix_keys.pop();
|
for (i = prefix_keys.pop(); i !== undefined; i = prefix_keys.pop()) {
|
||||||
while (i !== undefined) {
|
|
||||||
args_copy[i] = this.options.prefix + args_copy[i];
|
args_copy[i] = this.options.prefix + args_copy[i];
|
||||||
i = prefix_keys.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeof this.options.rename_commands !== 'undefined' && this.options.rename_commands[command]) {
|
||||||
|
command = this.options.rename_commands[command];
|
||||||
|
}
|
||||||
// Always use 'Multi bulk commands', but if passed any Buffer args, then do multiple writes, one for each arg.
|
// Always use 'Multi bulk commands', but if passed any Buffer args, then do multiple writes, one for each arg.
|
||||||
// This means that using Buffers in commands is going to be slower, so use Strings if you don't already have a Buffer.
|
// This means that using Buffers in commands is going to be slower, so use Strings if you don't already have a Buffer.
|
||||||
command_str = '*' + (len + 1) + '\r\n$' + command.length + '\r\n' + command + '\r\n';
|
command_str = '*' + (len + 1) + '\r\n$' + command.length + '\r\n' + command + '\r\n';
|
||||||
|
@@ -27,7 +27,7 @@ describe("rename commands", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('ready', function () {
|
client.on('ready', function () {
|
||||||
done();
|
client.flushdb(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user