forked from redis/ioredis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cluster): autopipeline when keyPrefix is used
Previously the building of pipelines ignored the key prefix. It was possible that two keys, foo and bar, might be set into the same pipeline. However, after being prefixed by a configured "keyPrefix" value, they may no longer belong to the same pipeline. This led to the error: "All keys in the pipeline should belong to the same slots allocation group" Amended version of https://github.com/luin/ioredis/pull/1335/files - see comments on that PR This may fix redis#1264 and redis#1248.
- Loading branch information
1 parent
beefcc1
commit 07486a1
Showing
3 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as sinon from "sinon"; | ||
import { expect } from "chai"; | ||
import { getFirstValueInFlattenedArray } from "../../lib/autoPipelining"; | ||
|
||
describe("autoPipelining", function () { | ||
it("should be able to efficiently get array args", function () { | ||
expect(getFirstValueInFlattenedArray([])).to.eql(undefined); | ||
expect(getFirstValueInFlattenedArray([null, "key"])).to.eql(null); | ||
expect(getFirstValueInFlattenedArray(["key", "value"])).to.eql("key"); | ||
expect(getFirstValueInFlattenedArray([[], "key"])).to.eql("key"); | ||
expect(getFirstValueInFlattenedArray([["key"]])).to.eql("key"); | ||
// @ts-ignore | ||
expect(getFirstValueInFlattenedArray([[["key"]]])).to.eql(["key"]); | ||
// @ts-ignore | ||
expect(getFirstValueInFlattenedArray([0, 1, 2, 3, 4])).to.eql(0); | ||
// @ts-ignore | ||
expect(getFirstValueInFlattenedArray([[true]])).to.eql(true); | ||
}); | ||
}); |