Commit 808e70e9 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Use fully qualified modules in connection proxy

An instance of this class is stored in memory in a class instance
variable. When this class is stale, it causes code-reloading issues
when `Gitlab::Database::LoadBalancing::ConnectionProxy.const_missing` is
triggered.

This is a workaround so that `Object.const_missing` is triggered instead
parent ccd02e1a
......@@ -64,7 +64,7 @@ module Gitlab
#
# name - The name of the method to call on a connection object.
def read_using_load_balancer(name, args, &block)
method = Session.current.use_primary? ? :read_write : :read
method = ::Gitlab::Database::LoadBalancing::Session.current.use_primary? ? :read_write : :read
@load_balancer.send(method) do |connection|
connection.send(name, *args, &block)
......@@ -81,7 +81,7 @@ module Gitlab
# Sticking has to be enabled before calling the method. Not doing so
# could lead to methods called in a block still being performed on a
# secondary instead of on a primary (when necessary).
Session.current.write! if sticky
::Gitlab::Database::LoadBalancing::Session.current.write! if sticky
connection.send(name, *args, &block)
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