Skip to content

Commit 7b1b9c4

Browse files
committed
chore: upgrade ioredis to v5
1 parent dc7bcd9 commit 7b1b9c4

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@
4545
]
4646
},
4747
"devDependencies": {
48-
"@types/ioredis": "^4.28.8",
4948
"@types/node": "^17.0.21",
5049
"@typescript-eslint/eslint-plugin": "^5.13.0",
5150
"@typescript-eslint/parser": "^5.13.0",
5251
"ava": "^4.1.0",
5352
"eslint": "^8.10.0",
5453
"eslint-config-prettier": "^8.5.0",
5554
"eslint-plugin-prettier": "^4.0.0",
56-
"ioredis": "^4.28.5",
55+
"ioredis": "^5.2.3",
5756
"nodemon": "^2.0.15",
5857
"prettier": "^2.5.1",
5958
"typescript": "~4.6.2"

src/index.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,7 @@ export default class Redlock extends EventEmitter {
552552
let result: number;
553553
try {
554554
// Attempt to evaluate the script by its hash.
555-
const shaResult = (await client.evalsha(script.hash, keys.length, [
556-
...keys,
557-
...args,
558-
])) as unknown;
559-
555+
const shaResult = await client.evalsha(script.hash, keys.length, ...keys, ...args);
560556
if (typeof shaResult !== "number") {
561557
throw new Error(
562558
`Unexpected result of type ${typeof shaResult} returned from redis.`
@@ -573,10 +569,7 @@ export default class Redlock extends EventEmitter {
573569
) {
574570
throw error;
575571
}
576-
const rawResult = (await client.eval(script.value, keys.length, [
577-
...keys,
578-
...args,
579-
])) as unknown;
572+
const rawResult = await client.eval(script.value, keys.length, ...keys, ...args);
580573

581574
if (typeof rawResult !== "number") {
582575
throw new Error(

src/multi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ${(await Promise.all(error.attempts))
3434
async function waitForCluster(redis: Cluster): Promise<void> {
3535
async function checkIsReady(): Promise<boolean> {
3636
return (
37-
((await redis.cluster("info")) as string).match(
37+
((await redis.cluster("INFO")) as string).match(
3838
/^cluster_state:(.+)$/m
3939
)?.[1] === "ok"
4040
);

src/single.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ${(await Promise.all(error.attempts))
3434
async function waitForCluster(redis: Cluster): Promise<void> {
3535
async function checkIsReady(): Promise<boolean> {
3636
return (
37-
((await redis.cluster("info")) as string).match(
37+
((await redis.cluster("INFO")) as string).match(
3838
/^cluster_state:(.+)$/m
3939
)?.[1] === "ok"
4040
);

0 commit comments

Comments
 (0)