From 493d095691b15d4b9bdd08dba466d3a17e863e6c Mon Sep 17 00:00:00 2001 From: Damian Hodgkiss Date: Tue, 30 May 2017 15:19:52 +0930 Subject: [PATCH] feat(cluster): add option to control timeout on cluster slots refresh (#475) * add option to control refresh slots timeout * rename as per issue * missed one --- lib/cluster/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/cluster/index.js b/lib/cluster/index.js index bbe5e81f..19702e3c 100644 --- a/lib/cluster/index.js +++ b/lib/cluster/index.js @@ -35,6 +35,8 @@ var DelayQueue = require('./delay_queue'); * if `retryDelayOnClusterDown` is valid delay time. * @param {number} [options.retryDelayOnTryAgain=100] - When a TRYAGAIN error is received, client will retry * if `retryDelayOnTryAgain` is valid delay time. + * @param {number} [options.slotsRefreshTimeout=1000] - The milliseconds before a timeout occurs while refreshing + * slots from the cluster. * @param {Object} [options.redisOptions] - Passed to the constructor of `Redis`. * @extends [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) * @extends Commander @@ -103,7 +105,8 @@ Cluster.defaultOptions = { maxRedirections: 16, retryDelayOnFailover: 100, retryDelayOnClusterDown: 100, - retryDelayOnTryAgain: 100 + retryDelayOnTryAgain: 100, + slotsRefreshTimeout: 1000 }; util.inherits(Cluster, EventEmitter); @@ -609,7 +612,7 @@ Cluster.prototype.getInfoFromNode = function (redis, callback) { _this.connectionPool.reset(nodes); callback(); - }, 1000)); + }, this.options.slotsRefreshTimeout)); }; /**