From d4b78b7ff1f8e1f624e7fc870286deae7cab5c31 Mon Sep 17 00:00:00 2001 From: mk Date: Sat, 11 Oct 2025 13:09:57 +0800 Subject: [PATCH] Update: avoid command case mismatch in redis cluster (#2091) --- lualib/skynet/db/redis/cluster.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lualib/skynet/db/redis/cluster.lua b/lualib/skynet/db/redis/cluster.lua index 697befba..e526fe4d 100644 --- a/lualib/skynet/db/redis/cluster.lua +++ b/lualib/skynet/db/redis/cluster.lua @@ -167,9 +167,8 @@ end -- -- For commands we want to explicitly bad as they don't make sense -- in the context of cluster, nil is returned. -function rediscluster:get_key_from_command(argv) - local cmd,key = table.unpack(argv) - cmd = string.lower(cmd) +function rediscluster:get_key_from_command(cmd, argv) + local key = argv[2] -- argv[1] is cmd if cmd == "info" or cmd == "multi" or cmd == "exec" or @@ -314,8 +313,8 @@ end -- Dispatch commands. function rediscluster:call(...) local argv = table.pack(...) - local cmd = argv[1] - local key = self:get_key_from_command(argv) + local cmd = string.lower(argv[1]) + local key = self:get_key_from_command(cmd, argv) if not key then error("No way to dispatch this command to Redis Cluster: " .. tostring(argv[1])) end