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

wal_tracking_receiver.rb « load_balancing « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ef9bee42277ca1f532805f43e2d22ce79184e202 (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 Database
    module LoadBalancing
      module WalTrackingReceiver
        # NOTE: If there's no entry for a load balancer or no WAL locations were passed
        # we assume the sender does not care about LB and we assume nodes are in-sync.
        def databases_in_sync?(wal_locations)
          return true unless wal_locations.present?

          ::Gitlab::Database::LoadBalancing.each_load_balancer.all? do |lb|
            if (location = wal_locations.with_indifferent_access[lb.name])
              lb.select_up_to_date_host(location)
            else
              true
            end
          end
        end
      end
    end
  end
end