@@ -337,18 +337,19 @@ RedisClient.prototype.on_ready = function () {
337
337
} ;
338
338
339
339
RedisClient . prototype . on_info_cmd = function ( err , res ) {
340
+ if ( err ) {
341
+ err . message = "Ready check failed: " + err . message ;
342
+ this . emit ( "error" , err ) ;
343
+ return ;
344
+ }
345
+
340
346
var self = this ;
341
347
var obj = { } ;
342
348
var lines = res . toString ( ) . split ( "\r\n" ) ;
343
349
var i = 0 ;
344
350
var key = 'db' + i ;
345
351
var line , retry_time , parts , sub_parts ;
346
352
347
- if ( err ) {
348
- err . message = "Ready check failed: " + err . message ;
349
- return self . emit ( "error" , err ) ;
350
- }
351
-
352
353
for ( i = 0 ; i < lines . length ; i ++ ) {
353
354
parts = lines [ i ] . split ( ':' ) ;
354
355
if ( parts [ 1 ] ) {
@@ -369,9 +370,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
369
370
obj [ key ] = { } ;
370
371
while ( line = parts . pop ( ) ) {
371
372
sub_parts = line . split ( '=' ) ;
372
- if ( sub_parts [ 1 ] ) {
373
- obj [ key ] [ sub_parts [ 0 ] ] = + sub_parts [ 1 ] ;
374
- }
373
+ obj [ key ] [ sub_parts [ 0 ] ] = + sub_parts [ 1 ] ;
375
374
}
376
375
i ++ ;
377
376
key = 'db' + i ;
@@ -471,7 +470,7 @@ RedisClient.prototype.connection_gone = function (why) {
471
470
472
471
// If this is a requested shutdown, then don't retry
473
472
if ( this . closing ) {
474
- debug ( "connection ended from quit command, not retrying." ) ;
473
+ debug ( "Connection ended from quit command, not retrying." ) ;
475
474
this . flush_and_error ( new Error ( "Redis connection gone from " + why + " event." ) ) ;
476
475
return ;
477
476
}
@@ -656,7 +655,7 @@ RedisClient.prototype.return_reply = function (reply) {
656
655
this . emit ( "monitor" , timestamp , args ) ;
657
656
} else {
658
657
var err = new Error ( "node_redis command queue state error. If you can reproduce this, please report it." ) ;
659
- err . command = command_obj . command . toUpperCase ( ) ;
658
+ err . command_obj = command_obj ;
660
659
this . emit ( "error" , err ) ;
661
660
}
662
661
} ;
@@ -695,19 +694,8 @@ RedisClient.prototype.send_command = function (command, args, callback) {
695
694
callback = process . domain . bind ( callback ) ;
696
695
}
697
696
698
- // if the last argument is an array and command is sadd or srem, expand it out:
699
- // client.sadd(arg1, [arg2, arg3, arg4], cb);
700
- // converts to:
701
- // client.sadd(arg1, arg2, arg3, arg4, cb);
702
- if ( ( command === 'sadd' || command === 'srem' ) && args . length > 0 && Array . isArray ( args [ args . length - 1 ] ) ) {
703
- args = args . slice ( 0 , - 1 ) . concat ( args [ args . length - 1 ] ) ;
704
- }
705
-
706
- // if the value is undefined or null and command is set or setx, need not to send message to redis
707
697
if ( command === 'set' || command === 'setex' ) {
708
- if ( args . length === 0 ) {
709
- return ;
710
- }
698
+ // if the value is undefined or null and command is set or setx, need not to send message to redis
711
699
if ( args [ args . length - 1 ] === undefined || args [ args . length - 1 ] === null ) {
712
700
command = command . toUpperCase ( ) ;
713
701
err = new Error ( 'send_command: ' + command + ' value must not be undefined or null' ) ;
0 commit comments