@@ -337,18 +337,19 @@ RedisClient.prototype.on_ready = function () {
337337} ;
338338
339339RedisClient . 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+
340346 var self = this ;
341347 var obj = { } ;
342348 var lines = res . toString ( ) . split ( "\r\n" ) ;
343349 var i = 0 ;
344350 var key = 'db' + i ;
345351 var line , retry_time , parts , sub_parts ;
346352
347- if ( err ) {
348- err . message = "Ready check failed: " + err . message ;
349- return self . emit ( "error" , err ) ;
350- }
351-
352353 for ( i = 0 ; i < lines . length ; i ++ ) {
353354 parts = lines [ i ] . split ( ':' ) ;
354355 if ( parts [ 1 ] ) {
@@ -369,9 +370,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
369370 obj [ key ] = { } ;
370371 while ( line = parts . pop ( ) ) {
371372 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 ] ;
375374 }
376375 i ++ ;
377376 key = 'db' + i ;
@@ -471,7 +470,7 @@ RedisClient.prototype.connection_gone = function (why) {
471470
472471 // If this is a requested shutdown, then don't retry
473472 if ( this . closing ) {
474- debug ( "connection ended from quit command, not retrying." ) ;
473+ debug ( "Connection ended from quit command, not retrying." ) ;
475474 this . flush_and_error ( new Error ( "Redis connection gone from " + why + " event." ) ) ;
476475 return ;
477476 }
@@ -656,7 +655,7 @@ RedisClient.prototype.return_reply = function (reply) {
656655 this . emit ( "monitor" , timestamp , args ) ;
657656 } else {
658657 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 ;
660659 this . emit ( "error" , err ) ;
661660 }
662661} ;
@@ -695,19 +694,8 @@ RedisClient.prototype.send_command = function (command, args, callback) {
695694 callback = process . domain . bind ( callback ) ;
696695 }
697696
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
707697 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
711699 if ( args [ args . length - 1 ] === undefined || args [ args . length - 1 ] === null ) {
712700 command = command . toUpperCase ( ) ;
713701 err = new Error ( 'send_command: ' + command + ' value must not be undefined or null' ) ;
0 commit comments