Commit d0ecc3f9 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'improve-metrics-for-delete-objects-worker' into 'master'

Improve remaining work metrics for deleted objects worker

See merge request gitlab-org/gitlab!46154
parents e70f863d 9de6d3cd
...@@ -14,7 +14,7 @@ module Ci ...@@ -14,7 +14,7 @@ module Ci
def remaining_work_count(*args) def remaining_work_count(*args)
@remaining_work_count ||= service @remaining_work_count ||= service
.remaining_batches_count(max_batch_count: remaining_capacity) .remaining_batches_count(max_batch_count: max_running_jobs)
end end
def max_running_jobs def max_running_jobs
......
...@@ -9,9 +9,14 @@ RSpec.describe Ci::DeleteObjectsWorker do ...@@ -9,9 +9,14 @@ RSpec.describe Ci::DeleteObjectsWorker do
describe '#perform' do describe '#perform' do
it 'executes a service' do it 'executes a service' do
allow(worker).to receive(:max_running_jobs).and_return(25)
expect_next_instance_of(Ci::DeleteObjectsService) do |instance| expect_next_instance_of(Ci::DeleteObjectsService) do |instance|
expect(instance).to receive(:execute) expect(instance).to receive(:execute)
expect(instance).to receive(:remaining_batches_count).once.and_call_original expect(instance).to receive(:remaining_batches_count)
.with(max_batch_count: 25)
.once
.and_call_original
end end
worker.perform worker.perform
......
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