1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

add option socket_initialdelay

This commit is contained in:
Xin
2018-11-29 11:59:44 +11:00
parent bd66d6266e
commit 8ee1b9822b

View File

@@ -101,6 +101,10 @@ function RedisClient (options, stream) {
if (options.socket_keepalive === undefined) { if (options.socket_keepalive === undefined) {
options.socket_keepalive = true; 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) { for (var command in options.rename_commands) {
options.rename_commands[command.toLowerCase()] = options.rename_commands[command]; options.rename_commands[command.toLowerCase()] = options.rename_commands[command];
} }
@@ -416,7 +420,7 @@ RedisClient.prototype.on_connect = function () {
this.connected = true; this.connected = true;
this.ready = false; this.ready = false;
this.emitted_end = 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.stream.setTimeout(0);
this.emit('connect'); this.emit('connect');