Commit 1c837773 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use perform_with_capacity to schedule ReverificationBatchWorker

Geo::ReverificationBatchWorker uses the LimitedCapacity::Worker
concern. For that concern to work correctly, we must periodically
reschedule jobs and perform cleanup by calling perform_with_capacity.
Before this commit, we were never calling perform_with_capacity on
Geo::ReverificationBatchWorker, meaning we never ran the cleanup code.
This commit fixes that by replacing perform_async with
perform_with_capacity.
parent cf49dfd1
...@@ -46,7 +46,7 @@ module Geo ...@@ -46,7 +46,7 @@ module Geo
# Secondaries don't need to run this since they will receive an event for each # Secondaries don't need to run this since they will receive an event for each
# rechecksummed resource: https://gitlab.com/gitlab-org/gitlab/-/issues/13842 # rechecksummed resource: https://gitlab.com/gitlab-org/gitlab/-/issues/13842
::Geo::ReverificationBatchWorker.perform_async(replicable_name) if ::Gitlab::Geo.primary? ::Geo::ReverificationBatchWorker.perform_with_capacity(replicable_name) if ::Gitlab::Geo.primary?
end end
# Called by VerificationBatchWorker. # Called by VerificationBatchWorker.
......
...@@ -148,7 +148,7 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -148,7 +148,7 @@ RSpec.shared_examples 'a verifiable replicator' do
it 'does not enqueue ReverificationBatchWorker' do it 'does not enqueue ReverificationBatchWorker' do
stub_secondary_node stub_secondary_node
expect(::Geo::ReverificationBatchWorker).not_to receive(:perform_async) expect(::Geo::ReverificationBatchWorker).not_to receive(:perform_with_capacity)
described_class.trigger_background_verification described_class.trigger_background_verification
end end
...@@ -158,7 +158,7 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -158,7 +158,7 @@ RSpec.shared_examples 'a verifiable replicator' do
it 'enqueues ReverificationBatchWorker' do it 'enqueues ReverificationBatchWorker' do
stub_primary_node stub_primary_node
expect(::Geo::ReverificationBatchWorker).to receive(:perform_async).with(described_class.replicable_name) expect(::Geo::ReverificationBatchWorker).to receive(:perform_with_capacity).with(described_class.replicable_name)
described_class.trigger_background_verification described_class.trigger_background_verification
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