Commit a0d465de authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'fix-crosssloterror-with-no-keys' into 'master'

Don't raise CrossSlotError when no keys given

See merge request gitlab-org/gitlab!52887
parents c89d94e5 3a8a4ced
......@@ -61,7 +61,7 @@ module Gitlab
key_slot(args.first)
end
unless key_slots.uniq.length == 1
if key_slots.uniq.many? # rubocop: disable CodeReuse/ActiveRecord
raise CrossSlotError.new("Redis command #{command_name} arguments hash to different slots. See https://docs.gitlab.com/ee/development/redis.html#multi-key-commands")
end
end
......
......@@ -53,6 +53,7 @@ RSpec.describe Gitlab::Instrumentation::RedisClusterValidator do
:del | [%w(foo bar)] | true # Arguments can be a nested array
:del | %w(foo foo) | false
:hset | %w(foo bar) | false # Not a multi-key command
:mget | [] | false # This is invalid, but not because it's a cross-slot command
end
with_them do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment