Skip to content

Commit 8ee1b98

Browse files
committed
add option socket_initialdelay
1 parent bd66d62 commit 8ee1b98

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ function RedisClient (options, stream) {
101101
if (options.socket_keepalive === undefined) {
102102
options.socket_keepalive = true;
103103
}
104+
if (options.socket_initialdelay === undefined) {
105+
options.socket_initialdelay = 0;
106+
// set default to 0, which is aligned to https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay
107+
}
104108
for (var command in options.rename_commands) {
105109
options.rename_commands[command.toLowerCase()] = options.rename_commands[command];
106110
}
@@ -416,7 +420,7 @@ RedisClient.prototype.on_connect = function () {
416420
this.connected = true;
417421
this.ready = false;
418422
this.emitted_end = false;
419-
this.stream.setKeepAlive(this.options.socket_keepalive);
423+
this.stream.setKeepAlive(this.options.socket_keepalive, this.options.socket_initialdelay);
420424
this.stream.setTimeout(0);
421425

422426
this.emit('connect');

0 commit comments

Comments
 (0)