Commit d133de66 authored by Marius Bobin's avatar Marius Bobin

Add comment to explain why we're sorting the rows

parent a7d75d0b
...@@ -43,6 +43,9 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -43,6 +43,9 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker
private private
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
# We're adding the ordering clause by `created_at` and `project_id`
# because we want to force the query planner to use the
# `ci_builds_gitlab_monitor_metrics` index all the time.
def pending_builds(timeout) def pending_builds(timeout)
if Feature.enabled?(:ci_new_query_for_pending_stuck_jobs) if Feature.enabled?(:ci_new_query_for_pending_stuck_jobs)
Ci::Build.pending.created_at_before(timeout).updated_at_before(timeout).order(created_at: :asc, project_id: :asc) Ci::Build.pending.created_at_before(timeout).updated_at_before(timeout).order(created_at: :asc, project_id: :asc)
......
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