File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ every command on a client.
192
192
* ` socket_nodelay ` : defaults to ` true ` . Whether to call setNoDelay() on the TCP stream, which disables the
193
193
Nagle algorithm on the underlying socket. Setting this option to ` false ` can result in additional throughput at the
194
194
cost of more latency. Most applications will want this set to ` true ` .
195
+ * ` socket_keepalive ` defaults to ` false ` . Whether the keep-alive functionality is enabled on the underlying socket.
195
196
* ` no_ready_check ` : defaults to ` false ` . When a connection is established to the Redis server, the server might still
196
197
be loading the database from disk. While loading, the server not respond to any commands. To work around this,
197
198
` node_redis ` has a "ready check" which sends the ` INFO ` command to the server. The response from the ` INFO ` command
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ function RedisClient(stream, options) {
43
43
if ( this . options . socket_nodelay === undefined ) {
44
44
this . options . socket_nodelay = true ;
45
45
}
46
+ if ( this . options . socket_keepalive === undefined ) {
47
+ this . options . socket_keepalive = false ;
48
+ }
46
49
this . should_buffer = false ;
47
50
this . command_queue_high_water = this . options . command_queue_high_water || 1000 ;
48
51
this . command_queue_low_water = this . options . command_queue_low_water || 0 ;
@@ -253,6 +256,7 @@ RedisClient.prototype.on_connect = function () {
253
256
if ( this . options . socket_nodelay ) {
254
257
this . stream . setNoDelay ( ) ;
255
258
}
259
+ this . stream . setKeepAlive ( this . options . socket_keepalive ) ;
256
260
this . stream . setTimeout ( 0 ) ;
257
261
258
262
this . init_parser ( ) ;
You can’t perform that action at this time.
0 commit comments