From 3d2a995bf52f12ab73c57b21007b0f286b4f1d36 Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Sun, 12 Feb 2023 09:36:21 +0800 Subject: [PATCH] fix: Fix db parameter not working with auto pipelining --- lib/autoPipelining.ts | 1 + test/functional/autopipelining.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/autoPipelining.ts b/lib/autoPipelining.ts index 410507f7..68adc2a4 100644 --- a/lib/autoPipelining.ts +++ b/lib/autoPipelining.ts @@ -17,6 +17,7 @@ export const notAllowedAutoPipelineCommands = [ "psubscribe", "unsubscribe", "unpsubscribe", + "select", ]; function executeAutoPipeline(client, slotKey: string) { diff --git a/test/functional/autopipelining.ts b/test/functional/autopipelining.ts index c221316f..cfc62b1a 100644 --- a/test/functional/autopipelining.ts +++ b/test/functional/autopipelining.ts @@ -31,6 +31,16 @@ describe("autoPipelining for single node", () => { await promises; }); + it("should work with db parameter", async () => { + const redis = new Redis({ enableAutoPipelining: true, db: 1 }); + + redis.set("foo", "bar"); + await new Promise((resolve) => { + redis.once("ready", resolve); + }); + expect(await redis.get("foo")).to.eql("bar"); + }); + it("should not add blacklisted commands to auto pipelines", async () => { const redis = new Redis({ enableAutoPipelining: true,