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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/load_balancing/host_list.rb')
-rw-r--r--lib/gitlab/database/load_balancing/host_list.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/gitlab/database/load_balancing/host_list.rb b/lib/gitlab/database/load_balancing/host_list.rb
index 24800012947..aa731521732 100644
--- a/lib/gitlab/database/load_balancing/host_list.rb
+++ b/lib/gitlab/database/load_balancing/host_list.rb
@@ -8,13 +8,11 @@ module Gitlab
# hosts - The list of secondary hosts to add.
def initialize(hosts = [])
@hosts = hosts.shuffle
- @pools = Set.new
@index = 0
@mutex = Mutex.new
@hosts_gauge = Gitlab::Metrics.gauge(:db_load_balancing_hosts, 'Current number of load balancing hosts')
set_metrics!
- update_pools
end
def hosts
@@ -35,15 +33,16 @@ module Gitlab
@mutex.synchronize { @hosts.map { |host| [host.host, host.port] } }
end
- def manage_pool?(pool)
- @pools.include?(pool)
- end
-
def hosts=(hosts)
@mutex.synchronize do
+ ::Gitlab::Database::LoadBalancing::Logger.info(
+ event: :host_list_update,
+ message: "Updating the host list for service discovery",
+ host_list_length: hosts.length,
+ old_host_list_length: @hosts.length
+ )
@hosts = hosts
unsafe_shuffle
- update_pools
end
set_metrics!
@@ -89,10 +88,6 @@ module Gitlab
def set_metrics!
@hosts_gauge.set({}, @hosts.length)
end
-
- def update_pools
- @pools = Set.new(@hosts.map(&:pool))
- end
end
end
end