2020-10-13 11:08:53 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class DeleteObjectsWorker
|
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2020-10-13 11:08:53 -04:00
|
|
|
include LimitedCapacity::Worker
|
|
|
|
|
|
|
|
feature_category :continuous_integration
|
|
|
|
idempotent!
|
|
|
|
|
|
|
|
def perform_work(*args)
|
|
|
|
service.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
def remaining_work_count(*args)
|
|
|
|
@remaining_work_count ||= service
|
2020-10-30 11:08:59 -04:00
|
|
|
.remaining_batches_count(max_batch_count: max_running_jobs)
|
2020-10-13 11:08:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def max_running_jobs
|
2020-11-06 10:09:14 -05:00
|
|
|
if ::Feature.enabled?(:ci_delete_objects_medium_concurrency)
|
2020-10-13 11:08:53 -04:00
|
|
|
20
|
|
|
|
elsif ::Feature.enabled?(:ci_delete_objects_high_concurrency)
|
|
|
|
50
|
|
|
|
else
|
2020-11-06 10:09:14 -05:00
|
|
|
2
|
2020-10-13 11:08:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def service
|
|
|
|
@service ||= DeleteObjectsService.new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|