Commit 8cc47ea7 authored by Igor Drozdov's avatar Igor Drozdov

Add data consistency for UpdateAllMirrorsWorker

This worker doesn't perform SQL writes, we can request
replicas instead of primary
parent 85937dd2
---
name: load_balancing_for_update_all_mirrors_worker
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64526
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334162
milestone: '14.1'
type: development
group: group::source code
default_enabled: false
...@@ -7,6 +7,7 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -7,6 +7,7 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker
include CronjobQueue include CronjobQueue
feature_category :source_code_management feature_category :source_code_management
data_consistency :sticky, feature_flag: :load_balancing_for_update_all_mirrors_worker
LEASE_TIMEOUT = 5.minutes LEASE_TIMEOUT = 5.minutes
SCHEDULE_WAIT_TIMEOUT = 4.minutes SCHEDULE_WAIT_TIMEOUT = 4.minutes
......
...@@ -11,6 +11,11 @@ RSpec.describe UpdateAllMirrorsWorker do ...@@ -11,6 +11,11 @@ RSpec.describe UpdateAllMirrorsWorker do
stub_exclusive_lease stub_exclusive_lease
end end
it_behaves_like 'worker with data consistency',
described_class,
feature_flag: :load_balancing_for_update_all_mirrors_worker,
data_consistency: :sticky
describe '#perform' do describe '#perform' do
it 'does nothing if the database is read-only' do it 'does nothing if the database is read-only' do
allow(Gitlab::Database).to receive(:read_only?).and_return(true) allow(Gitlab::Database).to receive(:read_only?).and_return(true)
......
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