Commit 0cbbfe7c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'cat-replication-lag-maintenance-mode' into 'master'

Prevent Git operations from checking replication lag on non-Geo-secondary sites

See merge request gitlab-org/gitlab!73952
parents 6d499a19 369dbc7c
...@@ -55,7 +55,8 @@ module EE ...@@ -55,7 +55,8 @@ module EE
end end
def current_replication_lag_message def current_replication_lag_message
return if ::Gitlab::Database.read_write? || current_replication_lag == 0 return unless ::Gitlab::Geo.secondary?
return if current_replication_lag == 0
"Current replication lag: #{current_replication_lag} seconds" "Current replication lag: #{current_replication_lag} seconds"
end end
......
...@@ -331,6 +331,20 @@ RSpec.describe Gitlab::GitAccess do ...@@ -331,6 +331,20 @@ RSpec.describe Gitlab::GitAccess do
context 'git pull' do context 'git pull' do
it { expect { pull_changes }.not_to raise_error } it { expect { pull_changes }.not_to raise_error }
context 'for non-Geo with maintenance mode' do
before do
stub_maintenance_mode_setting(true)
end
it 'does not return a replication lag message nor call the lag check' do
allow_next_instance_of(Gitlab::Geo::HealthCheck) do |instance|
expect(instance).not_to receive(:db_replication_lag_seconds)
end
expect(pull_changes.console_messages).to be_empty
end
end
context 'for a secondary' do context 'for a secondary' do
let(:current_replication_lag) { nil } let(:current_replication_lag) { nil }
......
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