summaryrefslogtreecommitdiff
path: root/lib/gitlab/redis/db_load_balancing.rb
blob: 012764456112dc16dbb377d1869b044e3765e819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module Redis
    class DbLoadBalancing < ::Gitlab::Redis::Wrapper
      class << self
        # The data we store on DbLoadBalancing used to be stored on SharedState.
        def config_fallback
          SharedState
        end

        private

        def redis
          primary_store = ::Redis.new(params)
          secondary_store = ::Redis.new(config_fallback.params)

          MultiStore.new(primary_store, secondary_store, store_name)
        end
      end
    end
  end
end