Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/ci/register_job_service.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb
index 9d4cf5df713..99df63e19c6 100644
--- a/app/services/ci/register_job_service.rb
+++ b/app/services/ci/register_job_service.rb
@@ -108,13 +108,14 @@ module Ci
# this returns builds that are ordered by number of running builds
# we prefer projects that don't use shared runners at all
joins("LEFT JOIN (#{running_builds_for_shared_runners.to_sql}) AS project_builds ON ci_builds.project_id=project_builds.project_id")
- .order('COALESCE(project_builds.running_builds, 0) ASC', 'ci_builds.id ASC')
+ .order('COALESCE(project_builds.running_builds, 0) ASC', 'ci_builds.scheduler_priority DESC NULLS LAST', 'ci_builds.id ASC')
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def builds_for_project_runner
- new_builds.where(project: runner.projects.without_deleted.with_builds_enabled).order('id ASC')
+ new_builds.where(project: runner.projects.without_deleted.with_builds_enabled)
+ .order('ci_builds.scheduler_priority DESC NULLS LAST', 'ci_builds.id ASC')
end
# rubocop: enable CodeReuse/ActiveRecord
@@ -128,7 +129,8 @@ module Ci
.with_group_runners_enabled
.with_builds_enabled
.without_deleted
- new_builds.where(project: projects).order('id ASC')
+ new_builds.where(project: projects)
+ .order('ci_builds.scheduler_priority DESC NULLS LAST', 'ci_builds.id ASC')
end
# rubocop: enable CodeReuse/ActiveRecord