]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Fix sorting of the queue
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Sep 2023 12:36:39 +0000 (12:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Sep 2023 12:36:39 +0000 (12:36 +0000)
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 <michael.tremer@ipfire.org>
src/buildservice/jobs.py

index 84b240eb412f35725cf309b0dc232b9b0d72e33c..40da06e44839fb5f6876e33a87d02c09dec0316c 100644 (file)
@@ -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