Commit cf49dfd1 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remaining work does not depend on Sidekiq capacity

This updates the remaining_work_count method on two Geo workers that
use LimitedCapacity::Worker. The purpose of remaining_work_count is to
tell LimitedCapacity::Worker if there is work to be done. Whether
there is work to be done should not depend on how busy Sidekiq is.
parent 4af24c69
...@@ -25,7 +25,7 @@ module Geo ...@@ -25,7 +25,7 @@ module Geo
replicator_class = replicator_class_for(replicable_name) replicator_class = replicator_class_for(replicable_name)
@remaining_work_count ||= replicator_class @remaining_work_count ||= replicator_class
.remaining_reverification_batch_count(max_batch_count: remaining_capacity) .remaining_reverification_batch_count(max_batch_count: max_running_jobs)
end end
def max_running_jobs def max_running_jobs
......
...@@ -25,7 +25,7 @@ module Geo ...@@ -25,7 +25,7 @@ module Geo
replicator_class = replicator_class_for(replicable_name) replicator_class = replicator_class_for(replicable_name)
@remaining_work_count ||= replicator_class @remaining_work_count ||= replicator_class
.remaining_verification_batch_count(max_batch_count: remaining_capacity) .remaining_verification_batch_count(max_batch_count: max_running_jobs)
end end
def replicator_class_for(replicable_name) def replicator_class_for(replicable_name)
......
...@@ -38,7 +38,7 @@ RSpec.describe Geo::VerificationBatchWorker, :geo do ...@@ -38,7 +38,7 @@ RSpec.describe Geo::VerificationBatchWorker, :geo do
it 'returns remaining_verification_batch_count' do it 'returns remaining_verification_batch_count' do
expected = 7 expected = 7
args = { max_batch_count: 95 } args = { max_batch_count: 95 }
allow(job).to receive(:remaining_capacity).and_return(args[:max_batch_count]) allow(job).to receive(:max_running_jobs).and_return(args[:max_batch_count])
allow(::Gitlab::Geo::Replicator).to receive(:for_replicable_name).with(replicable_name).and_return(replicator_class) allow(::Gitlab::Geo::Replicator).to receive(:for_replicable_name).with(replicable_name).and_return(replicator_class)
expect(replicator_class).to receive(:remaining_verification_batch_count).with(args).and_return(expected) expect(replicator_class).to receive(:remaining_verification_batch_count).with(args).and_return(expected)
......
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