Commit 0f4e4830 authored by Stan Hu's avatar Stan Hu Committed by Thong Kuah

Move all core EE load balancing code to CE

This moves all files from:

ee/lib/gitlab/database/load_balancing* -> lib/gitlab/database
ee/spec/lib/gitlab/database/load_balancing* -> spec/lib/gitlab/database
parent a27800de
...@@ -2,24 +2,22 @@ ...@@ -2,24 +2,22 @@
# We need to run this initializer after migrations are done so it doesn't fail on CI # We need to run this initializer after migrations are done so it doesn't fail on CI
Gitlab.ee do if Gitlab::Database.cached_table_exists?('licenses')
if Gitlab::Database.cached_table_exists?('licenses') if Gitlab::Database::LoadBalancing.enable?
if Gitlab::Database::LoadBalancing.enable? Gitlab::Database.disable_prepared_statements
Gitlab::Database.disable_prepared_statements
Gitlab::Application.configure do |config| Gitlab::Application.configure do |config|
config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware) config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware)
end end
Gitlab::Database::LoadBalancing.configure_proxy
# This needs to be executed after fork of clustered processes Gitlab::Database::LoadBalancing.configure_proxy
Gitlab::Cluster::LifecycleEvents.on_worker_start do
# Service discovery must be started after configuring the proxy, as service
# discovery depends on this.
Gitlab::Database::LoadBalancing.start_service_discovery
end
# This needs to be executed after fork of clustered processes
Gitlab::Cluster::LifecycleEvents.on_worker_start do
# Service discovery must be started after configuring the proxy, as service
# discovery depends on this.
Gitlab::Database::LoadBalancing.start_service_discovery
end end
end end
end end
...@@ -52,7 +52,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::SrvResolver do ...@@ -52,7 +52,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::SrvResolver do
end end
def dns_response_packet_from_fixture(fixture_name) def dns_response_packet_from_fixture(fixture_name)
fixture = File.read(Rails.root + "ee/spec/fixtures/dns/#{fixture_name}.json") fixture = File.read(Rails.root + "spec/fixtures/dns/#{fixture_name}.json")
encoded_payload = Gitlab::Json.parse(fixture)['payload'] encoded_payload = Gitlab::Json.parse(fixture)['payload']
payload = Base64.decode64(encoded_payload) payload = Base64.decode64(encoded_payload)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment