Commit 4cc57b8c authored by Krasimir Angelov's avatar Krasimir Angelov

Merge branch 'fix-load-balancing-order' into 'master'

Add connection fallback to ActiveRecordProxy

See merge request gitlab-org/gitlab!71059
parents c54983df b1b48aa2
......@@ -7,7 +7,7 @@ module Gitlab
# "connection" method.
module ActiveRecordProxy
def connection
::Gitlab::Database::LoadBalancing.proxy
::Gitlab::Database::LoadBalancing.proxy || super
end
end
end
......
......@@ -16,5 +16,12 @@ RSpec.describe Gitlab::Database::LoadBalancing::ActiveRecordProxy do
expect(dummy.new.connection).to eq(proxy)
end
it 'returns a connection when no proxy is present' do
allow(Gitlab::Database::LoadBalancing).to receive(:proxy).and_return(nil)
expect(ActiveRecord::Base.connection)
.to eq(ActiveRecord::Base.retrieve_connection)
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