Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/instrumentation/redis_cluster_validator.rb')
-rw-r--r--lib/gitlab/instrumentation/redis_cluster_validator.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/gitlab/instrumentation/redis_cluster_validator.rb b/lib/gitlab/instrumentation/redis_cluster_validator.rb
index 1567e54d8da..948132e6edd 100644
--- a/lib/gitlab/instrumentation/redis_cluster_validator.rb
+++ b/lib/gitlab/instrumentation/redis_cluster_validator.rb
@@ -193,8 +193,7 @@ module Gitlab
keys = commands.map { |command| extract_keys(command) }.flatten
{
- # calculate key-slots only if not allowed
- valid: allow_cross_slot_commands? || !has_cross_slot_keys?(keys),
+ valid: !has_cross_slot_keys?(keys),
command_name: command_name,
key_count: keys.size,
allowed: allow_cross_slot_commands?
@@ -211,6 +210,10 @@ module Gitlab
Thread.current[:allow_cross_slot_commands] -= 1
end
+ def allow_cross_slot_commands?
+ Thread.current[:allow_cross_slot_commands].to_i > 0
+ end
+
private
def extract_keys(command)
@@ -226,10 +229,6 @@ module Gitlab
keys.map { |key| key_slot(key) }.uniq.many? # rubocop: disable CodeReuse/ActiveRecord
end
- def allow_cross_slot_commands?
- Thread.current[:allow_cross_slot_commands].to_i > 0
- end
-
def key_slot(key)
::Redis::Cluster::KeySlotConverter.convert(extract_hash_tag(key))
end