diff options
Diffstat (limited to 'lib/gitlab/patch/slot_loader.rb')
-rw-r--r-- | lib/gitlab/patch/slot_loader.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/patch/slot_loader.rb b/lib/gitlab/patch/slot_loader.rb new file mode 100644 index 00000000000..e302d844078 --- /dev/null +++ b/lib/gitlab/patch/slot_loader.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Gitlab + module Patch + module SlotLoader + 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 |