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/patch/command_loader.rb')
-rw-r--r--lib/gitlab/patch/command_loader.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/patch/command_loader.rb b/lib/gitlab/patch/command_loader.rb
new file mode 100644
index 00000000000..357b6270b0d
--- /dev/null
+++ b/lib/gitlab/patch/command_loader.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Patch
+ module CommandLoader
+ extend ActiveSupport::Concern
+
+ class_methods do
+ # Shuffle the node list to spread out initial connection creation amongst all nodes
+ #
+ # The input is a Redis::Cluster::Node instance which is an Enumerable.
+ # `super` receives an Array of Redis::Client instead of a Redis::Cluster::Node
+ def load(nodes)
+ super(nodes.to_a.shuffle)
+ end
+ end
+ end
+ end
+end