Comparing version 4.27.6 to 4.27.7
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const PromiseContainer = require("./promiseContainer"); | ||
const lodash_1 = require("./utils/lodash"); | ||
const calculateSlot = require("cluster-key-slot"); | ||
@@ -65,2 +66,25 @@ const standard_as_callback_1 = require("standard-as-callback"); | ||
exports.shouldUseAutoPipelining = shouldUseAutoPipelining; | ||
/** | ||
* @private | ||
*/ | ||
function getFirstValueInFlattenedArray(args) { | ||
for (let i = 0; i < args.length; i++) { | ||
const arg = args[i]; | ||
if (typeof arg === "string") { | ||
return arg; | ||
} | ||
else if (Array.isArray(arg) || lodash_1.isArguments(arg)) { | ||
if (arg.length === 0) { | ||
continue; | ||
} | ||
return arg[0]; | ||
} | ||
const flattened = lodash_1.flatten([arg]); | ||
if (flattened.length > 0) { | ||
return flattened[0]; | ||
} | ||
} | ||
return undefined; | ||
} | ||
exports.getFirstValueInFlattenedArray = getFirstValueInFlattenedArray; | ||
function executeWithAutoPipelining(client, functionName, commandName, args, callback) { | ||
@@ -81,3 +105,8 @@ const CustomPromise = PromiseContainer.get(); | ||
// If we have slot information, we can improve routing by grouping slots served by the same subset of nodes | ||
const slotKey = client.isCluster ? client.slots[calculateSlot(args[0])].join(",") : 'main'; | ||
// Note that the first value in args may be a (possibly empty) array. | ||
// ioredis will only flatten one level of the array, in the Command constructor. | ||
const prefix = client.options.keyPrefix || ""; | ||
const slotKey = client.isCluster | ||
? client.slots[calculateSlot(`${prefix}${getFirstValueInFlattenedArray(args)}`)].join(",") | ||
: "main"; | ||
if (!client._autoPipelines.has(slotKey)) { | ||
@@ -84,0 +113,0 @@ const pipeline = client.pipeline(); |
@@ -7,3 +7,5 @@ "use strict"; | ||
exports.flatten = flatten; | ||
const isArguments = require("lodash.isarguments"); | ||
exports.isArguments = isArguments; | ||
function noop() { } | ||
exports.noop = noop; |
@@ -0,1 +1,8 @@ | ||
## [4.27.7](https://github.com/luin/ioredis/compare/v4.27.6...v4.27.7) (2021-08-01) | ||
### Bug Fixes | ||
* **cluster:** fix autopipeline with keyPrefix or arg array ([#1391](https://github.com/luin/ioredis/issues/1391)) ([d7477aa](https://github.com/luin/ioredis/commit/d7477aa5853388b51037210542372131919ddfb2)), closes [#1264](https://github.com/luin/ioredis/issues/1264) [#1248](https://github.com/luin/ioredis/issues/1248) [#1392](https://github.com/luin/ioredis/issues/1392) | ||
## [4.27.6](https://github.com/luin/ioredis/compare/v4.27.5...v4.27.6) (2021-06-13) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "ioredis", | ||
"version": "4.27.6", | ||
"version": "4.27.7", | ||
"description": "A robust, performance-focused and full-featured Redis client for Node.js.", | ||
@@ -41,2 +41,3 @@ "main": "built/index.js", | ||
"lodash.flatten": "^4.4.0", | ||
"lodash.isarguments": "^3.1.0", | ||
"p-map": "^2.1.0", | ||
@@ -57,2 +58,3 @@ "redis-commands": "1.7.0", | ||
"@types/lodash.flatten": "^4.4.6", | ||
"@types/lodash.isarguments": "^3.1.6", | ||
"@types/mocha": "^7.0.2", | ||
@@ -59,0 +61,0 @@ "@types/node": "^13.11.0", |
@@ -758,3 +758,3 @@ [![ioredis](https://cdn.jsdelivr.net/gh/luin/ioredis@b5e8c74/logo.svg)](https://github.com/luin/ioredis) | ||
On ElastiCache insances with Auto-failover enabled, `reconnectOnError` does not execute. Instead of returning a Redis error, AWS closes all connections to the master endpoint until the new primary node is ready. ioredis reconnects via `retryStrategy` instead of `reconnectOnError` after about a minute. On ElastiCache insances with Auto-failover enabled, test failover events with the `Failover primary` option in the AWS console. | ||
On ElastiCache instances with Auto-failover enabled, `reconnectOnError` does not execute. Instead of returning a Redis error, AWS closes all connections to the master endpoint until the new primary node is ready. ioredis reconnects via `retryStrategy` instead of `reconnectOnError` after about a minute. On ElastiCache instances with Auto-failover enabled, test failover events with the `Failover primary` option in the AWS console. | ||
@@ -761,0 +761,0 @@ ## Connection Events |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
293545
4861
11
32
+ Addedlodash.isarguments@^3.1.0
+ Addedlodash.isarguments@3.1.0(transitive)