diff options
Diffstat (limited to 'app/workers/ci/archive_traces_cron_worker.rb')
-rw-r--r-- | app/workers/ci/archive_traces_cron_worker.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/workers/ci/archive_traces_cron_worker.rb b/app/workers/ci/archive_traces_cron_worker.rb index 12856805243..fe23d10c2ac 100644 --- a/app/workers/ci/archive_traces_cron_worker.rb +++ b/app/workers/ci/archive_traces_cron_worker.rb @@ -9,14 +9,20 @@ module Ci include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :continuous_integration + deduplicate :until_executed, including_scheduled: true # rubocop: disable CodeReuse/ActiveRecord def perform # Archive stale live traces which still resides in redis or database # This could happen when Ci::ArchiveTraceWorker sidekiq jobs were lost by receiving SIGKILL # More details in https://gitlab.com/gitlab-org/gitlab-foss/issues/36791 - Ci::Build.with_stale_live_trace.find_each(batch_size: 100) do |build| - Ci::ArchiveTraceService.new.execute(build, worker_name: self.class.name) + + if Feature.enabled?(:deduplicate_archive_traces_cron_worker) + Ci::ArchiveTraceService.new.batch_execute(worker_name: self.class.name) + else + Ci::Build.with_stale_live_trace.find_each(batch_size: 100) do |build| + Ci::ArchiveTraceService.new.execute(build, worker_name: self.class.name) + end end end # rubocop: enable CodeReuse/ActiveRecord |