debian-mirror-gitlab/app/workers/ci/archive_traces_cron_worker.rb

22 lines
810 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
module Ci
2020-04-08 14:13:33 +05:30
class ArchiveTracesCronWorker # rubocop:disable Scalability/IdempotentWorker
2018-11-08 19:23:39 +05:30
include ApplicationWorker
2020-03-13 15:44:24 +05:30
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
2018-11-08 19:23:39 +05:30
2019-12-21 20:55:43 +05:30
feature_category :continuous_integration
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2018-11-08 19:23:39 +05:30
def perform
# Archive stale live traces which still resides in redis or database
# This could happen when ArchiveTraceWorker sidekiq jobs were lost by receiving SIGKILL
2019-12-04 20:38:33 +05:30
# 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|
2019-10-12 21:52:04 +05:30
Ci::ArchiveTraceService.new.execute(build, worker_name: self.class.name)
2018-11-08 19:23:39 +05:30
end
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2018-11-08 19:23:39 +05:30
end
end