Commit 02fcb882 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch...

Merge branch '322537-pages-migration-fix-pg-foreignkeyviolation-error-insert-or-update-on-table' into 'master'

Disable load balancing when running rake tasks

See merge request gitlab-org/gitlab!55632
parents c05acf6f c9f7b13e
......@@ -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