ioredis 4.27.4 → 4.27.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.27.5](https://github.com/luin/ioredis/compare/v4.27.4...v4.27.5) (2021-06-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **SENTINEL:** actively failover detection under an option ([#1363](https://github.com/luin/ioredis/issues/1363)) ([f02e383](https://github.com/luin/ioredis/commit/f02e383996310adaefc2b4c40d946b76e450e5c7))
7
+
1
8
  ## [4.27.4](https://github.com/luin/ioredis/compare/v4.27.3...v4.27.4) (2021-06-04)
2
9
 
3
10
 
@@ -205,6 +205,9 @@ class SentinelConnector extends AbstractConnector_1.default {
205
205
  initFailoverDetector() {
206
206
  var _a;
207
207
  return __awaiter(this, void 0, void 0, function* () {
208
+ if (!this.options.failoverDetector) {
209
+ return;
210
+ }
208
211
  // Move the current sentinel to the first position
209
212
  this.sentinelIterator.reset(true);
210
213
  const sentinels = [];
@@ -31,6 +31,7 @@ exports.DEFAULT_REDIS_OPTIONS = {
31
31
  natMap: null,
32
32
  enableTLSForSentinelMode: false,
33
33
  updateSentinels: true,
34
+ failoverDetector: false,
34
35
  // Status
35
36
  username: null,
36
37
  password: null,
@@ -93,6 +93,11 @@ const debug = utils_1.Debug("redis");
93
93
  * @param {NatMap} [options.natMap=null] NAT map for sentinel connector.
94
94
  * @param {boolean} [options.updateSentinels=true] - Update the given `sentinels` list with new IP
95
95
  * addresses when communicating with existing sentinels.
96
+ * @param {boolean} [options.failoverDetector=false] - Detect failover actively by subscribing to the
97
+ * related channels. With this option disabled, ioredis is still able to detect failovers because Redis
98
+ * Sentinel will disconnect all clients whenever a failover happens, so ioredis will reconnect to the new
99
+ * master. This option is useful when you want to detect failover quicker, but it will create more TCP
100
+ * connections to Redis servers in order to subscribe to related channels.
96
101
  * @param {boolean} [options.enableAutoPipelining=false] - When enabled, all commands issued during an event loop
97
102
  * iteration are automatically wrapped in a pipeline and sent to the server at the same time.
98
103
  * This can dramatically improve performance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ioredis",
3
- "version": "4.27.4",
3
+ "version": "4.27.5",
4
4
  "description": "A robust, performance-focused and full-featured Redis client for Node.js.",
5
5
  "main": "built/index.js",
6
6
  "files": [