From: Michael Tremer Date: Sun, 17 Sep 2023 12:36:39 +0000 (+0000) Subject: jobs: Fix sorting of the queue X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbc4977357a2ff54ca6c98586a0c159c98030c79;p=pbs.git jobs: Fix sorting of the queue Scratch builds are now being moved to the top of the queue and packages will be built by when their dependency check has succeeded. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 84b240eb..40da06e4 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -25,7 +25,20 @@ JOB_QUEUE_CTE = """ SELECT jobs.*, rank() OVER ( - ORDER BY (NOT builds.test), builds.priority DESC, jobs.created_at + ORDER BY + builds.priority DESC, + + -- Put test builds at the end of the queue + CASE + WHEN builds.test THEN 1 + ELSE 0 + END, + + -- Order by when the install check succeeded + jobs.installcheck_performed_at, + + -- If there is anything else, order by creation time + jobs.created_at ) AS _rank FROM jobs