Module: Gitlab::Database::LoadBalancing::WalTrackingReceiver

Included in:
SidekiqServerMiddleware, Graphql::Subscriptions::ActionCableWithLoadBalancing
Defined in:
lib/gitlab/database/load_balancing/wal_tracking_receiver.rb

Instance Method Summary collapse

Instance Method Details

#databases_in_sync?(wal_locations) ⇒ Boolean

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.

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/database/load_balancing/wal_tracking_receiver.rb', line 9

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) != LoadBalancer::NONE_CAUGHT_UP
    else
      true
    end
  end
end