mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
Update: avoid command case mismatch in redis cluster (#2091)
This commit is contained in:
@@ -167,9 +167,8 @@ end
|
|||||||
--
|
--
|
||||||
-- For commands we want to explicitly bad as they don't make sense
|
-- For commands we want to explicitly bad as they don't make sense
|
||||||
-- in the context of cluster, nil is returned.
|
-- in the context of cluster, nil is returned.
|
||||||
function rediscluster:get_key_from_command(argv)
|
function rediscluster:get_key_from_command(cmd, argv)
|
||||||
local cmd,key = table.unpack(argv)
|
local key = argv[2] -- argv[1] is cmd
|
||||||
cmd = string.lower(cmd)
|
|
||||||
if cmd == "info" or
|
if cmd == "info" or
|
||||||
cmd == "multi" or
|
cmd == "multi" or
|
||||||
cmd == "exec" or
|
cmd == "exec" or
|
||||||
@@ -314,8 +313,8 @@ end
|
|||||||
-- Dispatch commands.
|
-- Dispatch commands.
|
||||||
function rediscluster:call(...)
|
function rediscluster:call(...)
|
||||||
local argv = table.pack(...)
|
local argv = table.pack(...)
|
||||||
local cmd = argv[1]
|
local cmd = string.lower(argv[1])
|
||||||
local key = self:get_key_from_command(argv)
|
local key = self:get_key_from_command(cmd, argv)
|
||||||
if not key then
|
if not key then
|
||||||
error("No way to dispatch this command to Redis Cluster: " .. tostring(argv[1]))
|
error("No way to dispatch this command to Redis Cluster: " .. tostring(argv[1]))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user