2021-09-30 23:02:18 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class ArchiveTraceWorker # rubocop:disable Scalability/IdempotentWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
data_consistency :sticky, feature_flag: :sticky_ci_archive_trace_worker
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
sidekiq_options retry: 3
|
|
|
|
include PipelineBackgroundQueue
|
|
|
|
|
|
|
|
def perform(job_id)
|
2022-07-23 23:45:48 +05:30
|
|
|
archivable_jobs = Ci::Build.without_archived_trace
|
|
|
|
|
|
|
|
if Feature.enabled?(:sticky_ci_archive_trace_worker)
|
|
|
|
archivable_jobs = archivable_jobs.eager_load_for_archiving_trace
|
|
|
|
end
|
|
|
|
|
|
|
|
archivable_jobs.find_by_id(job_id).try do |job|
|
2021-09-30 23:02:18 +05:30
|
|
|
Ci::ArchiveTraceService.new.execute(job, worker_name: self.class.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|