From 82918d14b354214c04c3a33f7cbaeb3a0a04c2c2 Mon Sep 17 00:00:00 2001 From: uki00a Date: Mon, 4 Nov 2024 15:29:51 +0900 Subject: [PATCH] fix --- experimental/cluster/mod.ts | 2 +- tests/cluster/test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/experimental/cluster/mod.ts b/experimental/cluster/mod.ts index fddf6cb7..29564cfc 100644 --- a/experimental/cluster/mod.ts +++ b/experimental/cluster/mod.ts @@ -296,7 +296,7 @@ class ClusterExecutor implements CommandExecutor { async #closeExistingConnection() { const nodeNames = Object.keys(this.#connectionByNodeName); while (nodeNames.length >= this.#maxConnections) { - const nodeName = sample(nodeNames); + const nodeName = sample(nodeNames)!; const conn = this.#connectionByNodeName[nodeName]; delete this.#connectionByNodeName[nodeName]; try { diff --git a/tests/cluster/test.ts b/tests/cluster/test.ts index a3e72e8a..fab48e29 100644 --- a/tests/cluster/test.ts +++ b/tests/cluster/test.ts @@ -88,7 +88,7 @@ describe("experimental/cluster", () => { const slot = calculateSlot(key); manuallyRedirectedPort = sample( ports.filter((x) => x !== opts.port), - ); + )!; const error = new ErrorReplyError( `-MOVED ${slot} ${opts.hostname}:${manuallyRedirectedPort}`, ); @@ -147,7 +147,7 @@ describe("experimental/cluster", () => { const slot = calculateSlot(key); manuallyRedirectedPort = sample( ports.filter((x) => x !== opts.port), - ); + )!; const error = new ErrorReplyError( `-ASK ${slot} ${opts.hostname}:${manuallyRedirectedPort}`, );