From 8ee1b9822b1d42f57bb84dcc86d8727266bd5e4c Mon Sep 17 00:00:00 2001 From: Xin Date: Thu, 29 Nov 2018 11:59:44 +1100 Subject: [PATCH] add option socket_initialdelay --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 271d53db437..ce667a9dd49 100644 --- a/index.js +++ b/index.js @@ -101,6 +101,10 @@ function RedisClient (options, stream) { if (options.socket_keepalive === undefined) { options.socket_keepalive = true; } + if (options.socket_initialdelay === undefined) { + options.socket_initialdelay = 0; + // set default to 0, which is aligned to https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay + } for (var command in options.rename_commands) { options.rename_commands[command.toLowerCase()] = options.rename_commands[command]; } @@ -416,7 +420,7 @@ RedisClient.prototype.on_connect = function () { this.connected = true; this.ready = false; this.emitted_end = false; - this.stream.setKeepAlive(this.options.socket_keepalive); + this.stream.setKeepAlive(this.options.socket_keepalive, this.options.socket_initialdelay); this.stream.setTimeout(0); this.emit('connect');