28
28
parsers . push ( require ( "./lib/parser/hiredis" ) ) ;
29
29
} catch ( err ) {
30
30
/* istanbul ignore next: won't be reached with tests */
31
- debug ( "hiredis parser not installed." ) ;
31
+ debug ( "Hiredis parser not installed." ) ;
32
32
}
33
33
34
34
parsers . push ( require ( "./lib/parser/javascript" ) ) ;
@@ -130,7 +130,7 @@ RedisClient.prototype.initialize_retry_vars = function () {
130
130
131
131
RedisClient . prototype . unref = function ( ) {
132
132
if ( this . connected ) {
133
- debug ( "unref 'ing the socket connection" ) ;
133
+ debug ( "Unref 'ing the socket connection" ) ;
134
134
this . stream . unref ( ) ;
135
135
} else {
136
136
debug ( "Not connected yet, will unref later" ) ;
@@ -327,7 +327,7 @@ RedisClient.prototype.on_ready = function () {
327
327
} ;
328
328
Object . keys ( this . subscription_set ) . forEach ( function ( key ) {
329
329
var parts = key . split ( " " ) ;
330
- debug ( "sending pub/sub on_ready " + parts [ 0 ] + ", " + parts [ 1 ] ) ;
330
+ debug ( "Sending pub/sub on_ready " + parts [ 0 ] + ", " + parts [ 1 ] ) ;
331
331
callback_count ++ ;
332
332
self . send_command ( parts [ 0 ] + "scribe" , [ parts [ 1 ] ] , callback ) ;
333
333
} ) ;
@@ -386,7 +386,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
386
386
RedisClient . prototype . ready_check = function ( ) {
387
387
var self = this ;
388
388
389
- debug ( "checking server ready state..." ) ;
389
+ debug ( "Checking server ready state..." ) ;
390
390
391
391
this . send_anyway = true ; // secret flag to send_command to send something even if not "ready"
392
392
this . info ( function ( err , res ) {
@@ -447,7 +447,7 @@ RedisClient.prototype.connection_gone = function (why) {
447
447
// If this is a requested shutdown, then don't retry
448
448
if ( this . closing ) {
449
449
this . retry_timer = null ;
450
- debug ( "connection ended from quit command, not retrying." ) ;
450
+ debug ( "Connection ended from quit command, not retrying." ) ;
451
451
return ;
452
452
}
453
453
@@ -464,7 +464,7 @@ RedisClient.prototype.connection_gone = function (why) {
464
464
this . retry_timer = null ;
465
465
// TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others
466
466
// want the program to exit. Right now, we just log, which doesn't really help in either case.
467
- debug ( "node_redis: Couldn't get Redis connection after " + this . max_attempts + " attempts." ) ;
467
+ debug ( "Couldn't get Redis connection after " + this . max_attempts + " attempts." ) ;
468
468
return ;
469
469
}
470
470
@@ -481,7 +481,7 @@ RedisClient.prototype.connection_gone = function (why) {
481
481
if ( self . connect_timeout && self . retry_totaltime >= self . connect_timeout ) {
482
482
self . retry_timer = null ;
483
483
// TODO - engage Redis is Broken mode for future commands, or whatever
484
- debug ( "node_redis: Couldn't get Redis connection after " + self . retry_totaltime + "ms." ) ;
484
+ debug ( "Couldn't get Redis connection after " + self . retry_totaltime + "ms." ) ;
485
485
return ;
486
486
}
487
487
@@ -492,7 +492,8 @@ RedisClient.prototype.connection_gone = function (why) {
492
492
} ;
493
493
494
494
RedisClient . prototype . on_data = function ( data ) {
495
- debug ( "net read " + this . address + " id " + this . connection_id + ": " + data . toString ( ) ) ;
495
+ // The data.toString() has a significant impact on big chunks and therefor this should only be used if necessary
496
+ // debug("Net read " + this.address + " id " + this.connection_id + ": " + data.toString());
496
497
497
498
try {
498
499
this . reply_parser . execute ( data ) ;
@@ -570,7 +571,7 @@ RedisClient.prototype.return_reply = function (reply) {
570
571
}
571
572
572
573
if ( this . pub_sub_mode && ( type === 'message' || type === 'pmessage' ) ) {
573
- debug ( "received pubsub message" ) ;
574
+ debug ( "Received pubsub message" ) ;
574
575
}
575
576
else {
576
577
command_obj = this . command_queue . shift ( ) ;
@@ -602,7 +603,7 @@ RedisClient.prototype.return_reply = function (reply) {
602
603
603
604
command_obj . callback ( null , reply ) ;
604
605
} else {
605
- debug ( "no callback for reply: " + ( reply && reply . toString && reply . toString ( ) ) ) ;
606
+ debug ( "No callback for reply" ) ;
606
607
}
607
608
} else if ( this . pub_sub_mode || ( command_obj && command_obj . sub_command ) ) {
608
609
if ( Array . isArray ( reply ) ) {
@@ -725,12 +726,11 @@ RedisClient.prototype.send_command = function (command, args, callback) {
725
726
726
727
command_obj = new Command ( command , args , false , buffer_args , callback ) ;
727
728
728
- if ( ( ! this . ready && ! this . send_anyway ) || ! stream . writable ) {
729
- if ( ! stream . writable ) {
730
- debug ( "send command: stream is not writeable." ) ;
731
- }
732
-
729
+ if ( ! this . ready && ! this . send_anyway || ! stream . writable ) {
733
730
if ( this . enable_offline_queue ) {
731
+ if ( ! stream . writable ) {
732
+ debug ( "send command: stream is not writeable." ) ;
733
+ }
734
734
debug ( "Queueing " + command + " for next server connection." ) ;
735
735
this . offline_queue . push ( command_obj ) ;
736
736
this . should_buffer = true ;
@@ -767,18 +767,18 @@ RedisClient.prototype.send_command = function (command, args, callback) {
767
767
768
768
command_str = "*" + elem_count + "\r\n$" + command . length + "\r\n" + command + "\r\n" ;
769
769
770
- if ( ! buffer_args ) { // Build up a string and send entire command in one write
770
+ if ( ! buffer_args ) { // Build up a string and send entire command in one write
771
771
for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
772
772
arg = args [ i ] ;
773
773
if ( typeof arg !== "string" ) {
774
774
arg = String ( arg ) ;
775
775
}
776
776
command_str += "$" + Buffer . byteLength ( arg ) + "\r\n" + arg + "\r\n" ;
777
777
}
778
- debug ( "send " + this . address + " id " + this . connection_id + ": " + command_str ) ;
778
+ debug ( "Send " + this . address + " id " + this . connection_id + ": " + command_str ) ;
779
779
buffered_writes += ! stream . write ( command_str ) ;
780
780
} else {
781
- debug ( "send command (" + command_str + ") has Buffer arguments" ) ;
781
+ debug ( "Send command (" + command_str + ") has Buffer arguments" ) ;
782
782
buffered_writes += ! stream . write ( command_str ) ;
783
783
784
784
for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
0 commit comments