31
31
parsers . push ( require ( "./lib/parser/hiredis" ) ) ;
32
32
} catch ( err ) {
33
33
/* istanbul ignore next: won't be reached with tests */
34
- debug ( "hiredis parser not installed." ) ;
34
+ debug ( "Hiredis parser not installed." ) ;
35
35
}
36
36
37
37
parsers . push ( require ( "./lib/parser/javascript" ) ) ;
@@ -133,7 +133,7 @@ RedisClient.prototype.initialize_retry_vars = function () {
133
133
134
134
RedisClient . prototype . unref = function ( ) {
135
135
if ( this . connected ) {
136
- debug ( "unref 'ing the socket connection" ) ;
136
+ debug ( "Unref 'ing the socket connection" ) ;
137
137
this . stream . unref ( ) ;
138
138
} else {
139
139
debug ( "Not connected yet, will unref later" ) ;
@@ -340,7 +340,7 @@ RedisClient.prototype.on_ready = function () {
340
340
} ;
341
341
Object . keys ( this . subscription_set ) . forEach ( function ( key ) {
342
342
var parts = key . split ( " " ) ;
343
- debug ( "sending pub/sub on_ready " + parts [ 0 ] + ", " + parts [ 1 ] ) ;
343
+ debug ( "Sending pub/sub on_ready " + parts [ 0 ] + ", " + parts [ 1 ] ) ;
344
344
callback_count ++ ;
345
345
self . send_command ( parts [ 0 ] + "scribe" , [ parts [ 1 ] ] , callback ) ;
346
346
} ) ;
@@ -399,7 +399,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
399
399
RedisClient . prototype . ready_check = function ( ) {
400
400
var self = this ;
401
401
402
- debug ( "checking server ready state..." ) ;
402
+ debug ( "Checking server ready state..." ) ;
403
403
404
404
this . send_anyway = true ; // secret flag to send_command to send something even if not "ready"
405
405
this . info ( function ( err , res ) {
@@ -460,7 +460,7 @@ RedisClient.prototype.connection_gone = function (why) {
460
460
// If this is a requested shutdown, then don't retry
461
461
if ( this . closing ) {
462
462
this . retry_timer = null ;
463
- debug ( "connection ended from quit command, not retrying." ) ;
463
+ debug ( "Connection ended from quit command, not retrying." ) ;
464
464
return ;
465
465
}
466
466
@@ -477,7 +477,7 @@ RedisClient.prototype.connection_gone = function (why) {
477
477
this . retry_timer = null ;
478
478
// TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others
479
479
// want the program to exit. Right now, we just log, which doesn't really help in either case.
480
- debug ( "node_redis: Couldn't get Redis connection after " + this . max_attempts + " attempts." ) ;
480
+ debug ( "Couldn't get Redis connection after " + this . max_attempts + " attempts." ) ;
481
481
return ;
482
482
}
483
483
@@ -494,7 +494,7 @@ RedisClient.prototype.connection_gone = function (why) {
494
494
if ( self . connect_timeout && self . retry_totaltime >= self . connect_timeout ) {
495
495
self . retry_timer = null ;
496
496
// TODO - engage Redis is Broken mode for future commands, or whatever
497
- debug ( "node_redis: Couldn't get Redis connection after " + self . retry_totaltime + "ms." ) ;
497
+ debug ( "Couldn't get Redis connection after " + self . retry_totaltime + "ms." ) ;
498
498
return ;
499
499
}
500
500
@@ -505,7 +505,8 @@ RedisClient.prototype.connection_gone = function (why) {
505
505
} ;
506
506
507
507
RedisClient . prototype . on_data = function ( data ) {
508
- debug ( "net read " + this . address + " id " + this . connection_id + ": " + data . toString ( ) ) ;
508
+ // The data.toString() has a significant impact on big chunks and therefor this should only be used if necessary
509
+ // debug("Net read " + this.address + " id " + this.connection_id + ": " + data.toString());
509
510
510
511
try {
511
512
this . reply_parser . execute ( data ) ;
@@ -608,7 +609,7 @@ RedisClient.prototype.return_reply = function (reply) {
608
609
}
609
610
610
611
if ( this . pub_sub_mode && ( type === 'message' || type === 'pmessage' ) ) {
611
- debug ( "received pubsub message" ) ;
612
+ debug ( "Received pubsub message" ) ;
612
613
}
613
614
else {
614
615
command_obj = this . command_queue . shift ( ) ;
@@ -640,7 +641,7 @@ RedisClient.prototype.return_reply = function (reply) {
640
641
641
642
try_callback ( command_obj . callback , reply ) ;
642
643
} else {
643
- debug ( "no callback for reply: " + ( reply && reply . toString && reply . toString ( ) ) ) ;
644
+ debug ( "No callback for reply" ) ;
644
645
}
645
646
} else if ( this . pub_sub_mode || ( command_obj && command_obj . sub_command ) ) {
646
647
if ( Array . isArray ( reply ) ) {
@@ -754,12 +755,11 @@ RedisClient.prototype.send_command = function (command, args, callback) {
754
755
755
756
command_obj = new Command ( command , args , false , buffer_args , callback ) ;
756
757
757
- if ( ( ! this . ready && ! this . send_anyway ) || ! stream . writable ) {
758
- if ( ! stream . writable ) {
759
- debug ( "send command: stream is not writeable." ) ;
760
- }
761
-
758
+ if ( ! this . ready && ! this . send_anyway || ! stream . writable ) {
762
759
if ( this . enable_offline_queue ) {
760
+ if ( ! stream . writable ) {
761
+ debug ( "send command: stream is not writeable." ) ;
762
+ }
763
763
debug ( "Queueing " + command + " for next server connection." ) ;
764
764
this . offline_queue . push ( command_obj ) ;
765
765
this . should_buffer = true ;
@@ -794,18 +794,18 @@ RedisClient.prototype.send_command = function (command, args, callback) {
794
794
795
795
command_str = "*" + elem_count + "\r\n$" + command . length + "\r\n" + command + "\r\n" ;
796
796
797
- if ( ! buffer_args ) { // Build up a string and send entire command in one write
797
+ if ( ! buffer_args ) { // Build up a string and send entire command in one write
798
798
for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
799
799
arg = args [ i ] ;
800
800
if ( typeof arg !== "string" ) {
801
801
arg = String ( arg ) ;
802
802
}
803
803
command_str += "$" + Buffer . byteLength ( arg ) + "\r\n" + arg + "\r\n" ;
804
804
}
805
- debug ( "send " + this . address + " id " + this . connection_id + ": " + command_str ) ;
805
+ debug ( "Send " + this . address + " id " + this . connection_id + ": " + command_str ) ;
806
806
buffered_writes += ! stream . write ( command_str ) ;
807
807
} else {
808
- debug ( "send command (" + command_str + ") has Buffer arguments" ) ;
808
+ debug ( "Send command (" + command_str + ") has Buffer arguments" ) ;
809
809
buffered_writes += ! stream . write ( command_str ) ;
810
810
811
811
for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
0 commit comments