Commit caaa7778 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'db_load_balancer_reloading_issue' into 'master'

Fix DB load balance autoloading/code-reloading

See merge request gitlab-org/gitlab!71218
parents bb3fe4a1 91b7cf3e
...@@ -35,12 +35,12 @@ module Gitlab ...@@ -35,12 +35,12 @@ module Gitlab
# connection.load_balancer.primary_write_location # connection.load_balancer.primary_write_location
# end # end
# #
job['wal_locations'] = { Gitlab::Database::MAIN_DATABASE_NAME.to_sym => wal_location } if wal_location job['wal_locations'] = { ::Gitlab::Database::MAIN_DATABASE_NAME.to_sym => wal_location } if wal_location
end end
def wal_location def wal_location
strong_memoize(:wal_location) do strong_memoize(:wal_location) do
if Session.current.use_primary? if ::Gitlab::Database::LoadBalancing::Session.current.use_primary?
load_balancer.primary_write_location load_balancer.primary_write_location
else else
load_balancer.host.database_replica_location load_balancer.host.database_replica_location
...@@ -49,7 +49,7 @@ module Gitlab ...@@ -49,7 +49,7 @@ module Gitlab
end end
def load_balancer def load_balancer
LoadBalancing.proxy.load_balancer ::Gitlab::Database::LoadBalancing.proxy.load_balancer
end end
end end
end end
......
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