You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Add a connection timeout of 24h as new default for maximum reconnecting
This commit is contained in:
@@ -194,8 +194,9 @@ with an error, or an error will be thrown if no callback is specified.
|
||||
* `retry_max_delay`: defaults to `null`. By default every time the client tries to connect and fails time before
|
||||
reconnection (delay) almost doubles. This delay normally grows infinitely, but setting `retry_max_delay` limits delay
|
||||
to maximum value, provided in milliseconds.
|
||||
* `connect_timeout` defaults to `false`. By default client will try reconnecting until connected. Setting `connect_timeout`
|
||||
limits total time for client to reconnect. Value is provided in milliseconds and is counted once the disconnect occured.
|
||||
* `connect_timeout` defaults to `86400000`. Setting `connect_timeout` limits total time for client to reconnect.
|
||||
Value is provided in milliseconds and is counted once the disconnect occured. The last retry is going to happen once after the connect_timeout value is exceeded.
|
||||
That way the default is to try reconnecting until at least 24h passed.
|
||||
* `max_attempts` defaults to `null`. By default client will try reconnecting until connected. Setting `max_attempts`
|
||||
limits total amount of reconnects.
|
||||
* `auth_pass` defaults to `null`. By default client will try connecting without auth. If set, client will run redis auth command on connect.
|
||||
|
4
index.js
4
index.js
@@ -58,9 +58,7 @@ function RedisClient(stream, options) {
|
||||
this.command_queue = new Queue(); // holds sent commands to de-pipeline them
|
||||
this.offline_queue = new Queue(); // holds commands issued but not able to be sent
|
||||
this.commands_sent = 0;
|
||||
if (options.connect_timeout && options.connect_timeout > 0) {
|
||||
this.connect_timeout = +options.connect_timeout;
|
||||
}
|
||||
this.connect_timeout = +options.connect_timeout || 86400000; // 24 * 60 * 60 * 1000 ms
|
||||
this.enable_offline_queue = true;
|
||||
if (this.options.enable_offline_queue === false) {
|
||||
this.enable_offline_queue = false;
|
||||
|
Reference in New Issue
Block a user