diff --git a/package.json b/package.json index 45e6d46..2fe4fee 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ ] }, "devDependencies": { - "@types/ioredis": "^4.28.8", "@types/node": "^17.0.21", "@typescript-eslint/eslint-plugin": "^5.13.0", "@typescript-eslint/parser": "^5.13.0", @@ -54,7 +53,7 @@ "eslint": "^8.10.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.0.0", - "ioredis": "^4.28.5", + "ioredis": "^5.2.3", "nodemon": "^2.0.15", "prettier": "^2.5.1", "typescript": "~4.6.2" diff --git a/src/index.ts b/src/index.ts index 660de59..c21ac5c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -558,11 +558,12 @@ export default class Redlock extends EventEmitter { let result: number; try { // Attempt to evaluate the script by its hash. - const shaResult = (await client.evalsha(script.hash, keys.length, [ + const shaResult = await client.evalsha( + script.hash, + keys.length, ...keys, - ...args, - ])) as unknown; - + ...args + ); if (typeof shaResult !== "number") { throw new Error( `Unexpected result of type ${typeof shaResult} returned from redis.` @@ -579,10 +580,12 @@ export default class Redlock extends EventEmitter { ) { throw error; } - const rawResult = (await client.eval(script.value, keys.length, [ + const rawResult = await client.eval( + script.value, + keys.length, ...keys, - ...args, - ])) as unknown; + ...args + ); if (typeof rawResult !== "number") { throw new Error( diff --git a/src/multi.test.ts b/src/multi.test.ts index 5049b3e..f423f20 100644 --- a/src/multi.test.ts +++ b/src/multi.test.ts @@ -34,7 +34,7 @@ ${(await Promise.all(error.attempts)) async function waitForCluster(redis: Cluster): Promise { async function checkIsReady(): Promise { return ( - ((await redis.cluster("info")) as string).match( + ((await redis.cluster("INFO")) as string).match( /^cluster_state:(.+)$/m )?.[1] === "ok" ); diff --git a/src/single.test.ts b/src/single.test.ts index 6a5990d..623e505 100644 --- a/src/single.test.ts +++ b/src/single.test.ts @@ -34,7 +34,7 @@ ${(await Promise.all(error.attempts)) async function waitForCluster(redis: Cluster): Promise { async function checkIsReady(): Promise { return ( - ((await redis.cluster("info")) as string).match( + ((await redis.cluster("INFO")) as string).match( /^cluster_state:(.+)$/m )?.[1] === "ok" );