Commit c9f7b13e authored by Vladimir Shushlin's avatar Vladimir Shushlin

Disable load balancing if running in rake task

rails now can run rake tasks, so we can't rely on the executable name
parent 5cbdfdbd
......@@ -84,7 +84,7 @@ module Gitlab
# Returns true if load balancing is to be enabled.
def self.enable?
return false if program_name == 'rake' || Gitlab::Runtime.sidekiq?
return false if Gitlab::Runtime.rake? || Gitlab::Runtime.sidekiq?
return false unless self.configured?
true
......
......@@ -146,7 +146,7 @@ RSpec.describe Gitlab::Database::LoadBalancing do
end
it 'returns false when running inside a Rake task' do
expect(described_class).to receive(:program_name).and_return('rake')
allow(Gitlab::Runtime).to receive(:rake?).and_return(true)
expect(described_class.enable?).to eq(false)
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