Commit 15204499 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Add context to the StuckCiJobsWorker

This adds context to the jobs scheduled from the
StuckCiJobsWorker. Which include:

- ExpireJobCacheWorker
- StageUpdateWorker
- BuildFinishedWorker
- PipelineProcessWorker
- PipelineUpdateWorker
- BuildHooksWorker
- BuildQueueWorker
- Deployments::FinishedWorker
- Ci::ResourceGroups::AssignResourceFromResourceGroupWorker
parent dd5500f1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
class StuckCiJobsWorker class StuckCiJobsWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext include CronjobQueue
feature_category :continuous_integration feature_category :continuous_integration
worker_resource_boundary :cpu worker_resource_boundary :cpu
...@@ -56,13 +56,13 @@ class StuckCiJobsWorker ...@@ -56,13 +56,13 @@ class StuckCiJobsWorker
loop do loop do
jobs = Ci::Build.where(status: status) jobs = Ci::Build.where(status: status)
.where(condition, timeout.ago) .where(condition, timeout.ago)
.includes(:tags, :runner, project: :namespace) .includes(:tags, :runner, project: [:namespace, :route])
.limit(100) .limit(100)
.to_a .to_a
break if jobs.empty? break if jobs.empty?
jobs.each do |job| jobs.each do |job|
yield(job) with_context(project: job.project) { yield(job) }
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment