Class: StuckMergeJobsWorker
- Inherits:
-
Object
- Object
- StuckMergeJobsWorker
- Includes:
- ApplicationWorker, CronjobQueue
- Defined in:
- app/workers/stuck_merge_jobs_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Class Method Summary collapse
Instance Method Summary collapse
-
#perform ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Class Method Details
Instance Method Details
#perform ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/workers/stuck_merge_jobs_worker.rb', line 17 def perform stuck_merge_requests.find_in_batches(batch_size: 100) do |group| jids = group.map(&:merge_jid) # Find the jobs that aren't currently running or that exceeded the threshold. completed_jids = Gitlab::SidekiqStatus.completed_jids(jids) if completed_jids.any? completed_ids = group.select { |merge_request| completed_jids.include?(merge_request.merge_jid) }.map(&:id) apply_current_state!(completed_jids, completed_ids) end end end |