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 typo in string conversion. Closes #918
This commit is contained in:
5
index.js
5
index.js
@@ -732,7 +732,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
|
|||||||
if (Buffer.isBuffer(args[i])) {
|
if (Buffer.isBuffer(args[i])) {
|
||||||
buffer_args = true;
|
buffer_args = true;
|
||||||
} else if (typeof args[i] !== 'string') {
|
} else if (typeof args[i] !== 'string') {
|
||||||
arg = String(arg);
|
args[i] = String(args[i]);
|
||||||
// 30000 seemed to be a good value to switch to buffers after testing this with and checking the pros and cons
|
// 30000 seemed to be a good value to switch to buffers after testing this with and checking the pros and cons
|
||||||
} else if (args[i].length > 30000) {
|
} else if (args[i].length > 30000) {
|
||||||
big_data = true;
|
big_data = true;
|
||||||
@@ -786,7 +786,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
|
|||||||
|
|
||||||
if (!buffer_args && !big_data) { // Build up a string and send entire command in one write
|
if (!buffer_args && !big_data) { // Build up a string and send entire command in one write
|
||||||
for (i = 0; i < args.length; i += 1) {
|
for (i = 0; i < args.length; i += 1) {
|
||||||
arg = String(args[i]);
|
arg = args[i];
|
||||||
command_str += '$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n';
|
command_str += '$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n';
|
||||||
}
|
}
|
||||||
debug('Send ' + this.address + ' id ' + this.connection_id + ': ' + command_str);
|
debug('Send ' + this.address + ' id ' + this.connection_id + ': ' + command_str);
|
||||||
@@ -798,7 +798,6 @@ RedisClient.prototype.send_command = function (command, args, callback) {
|
|||||||
for (i = 0; i < args.length; i += 1) {
|
for (i = 0; i < args.length; i += 1) {
|
||||||
arg = args[i];
|
arg = args[i];
|
||||||
if (!Buffer.isBuffer(arg)) {
|
if (!Buffer.isBuffer(arg)) {
|
||||||
arg = String(arg);
|
|
||||||
this.write('$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n');
|
this.write('$' + Buffer.byteLength(arg) + '\r\n' + arg + '\r\n');
|
||||||
} else {
|
} else {
|
||||||
this.write('$' + arg.length + '\r\n');
|
this.write('$' + arg.length + '\r\n');
|
||||||
|
Reference in New Issue
Block a user