debian-mirror-gitlab/lib/gitlab/database/load_balancing/wal_tracking_receiver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
702 B
Ruby
Raw Normal View History

2023-07-09 08:55:56 +05:30
# 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