Commit 48cb391c authored by Tomasz Maczukin's avatar Tomasz Maczukin

Improve builds search query

parent e9f83c4b
......@@ -40,7 +40,7 @@ class StuckCiBuildsWorker
def search(status, timeout)
builds = Ci::Build.where(status: status).where('ci_builds.updated_at < ?', timeout.ago)
builds.joins(:project).find_each(batch_size: 50).each do |build|
builds.joins(:project).includes(project: :namespace).includes(:tags).includes(:runner).find_each(batch_size: 50).each do |build|
yield(build)
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