2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class DeleteObjectsWorker
|
|
|
|
include ApplicationWorker
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
data_consistency :always
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
sidekiq_options retry: 3
|
2021-01-03 14:25:43 +05:30
|
|
|
include LimitedCapacity::Worker
|
|
|
|
|
|
|
|
feature_category :continuous_integration
|
|
|
|
idempotent!
|
|
|
|
|
|
|
|
def perform_work(*args)
|
|
|
|
service.execute
|
|
|
|
end
|
|
|
|
|
|
|
|
def remaining_work_count(*args)
|
|
|
|
@remaining_work_count ||= service
|
2021-01-29 00:20:46 +05:30
|
|
|
.remaining_batches_count(max_batch_count: max_running_jobs)
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def max_running_jobs
|
2021-01-29 00:20:46 +05:30
|
|
|
if ::Feature.enabled?(:ci_delete_objects_medium_concurrency)
|
2021-01-03 14:25:43 +05:30
|
|
|
20
|
|
|
|
elsif ::Feature.enabled?(:ci_delete_objects_high_concurrency)
|
|
|
|
50
|
|
|
|
else
|
2021-01-29 00:20:46 +05:30
|
|
|
2
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def service
|
|
|
|
@service ||= DeleteObjectsService.new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|