guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Tue, 9 Jan 2024 12:37:21 -0500 (EST)

branch: master
commit 5b72a68c3eda054dfe90e05c72792e6ca6d4a1a3
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Jan 9 14:41:38 2024 +0100

    database: Checking timing of ‘db-get-pending-build’.
    
    * src/cuirass/database.scm (db-get-pending-build): Wrap body in
    ‘with-timing-check’.
---
 src/cuirass/database.scm | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index dc6566f..8b1c093 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -1,7 +1,7 @@
 ;;; database.scm -- store evaluation and build results
 ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <othacehe@gnu.org>
-;;; Copyright © 2018, 2020, 2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2020, 2023-2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2018 Tatiana Sholokhova <tanja201396@gmail.com>
 ;;; Copyright © 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -1631,11 +1631,14 @@ SELECT derivation FROM Builds WHERE Builds.status < 
0;"))))
 (define (db-get-pending-build system)
   "Return the oldest pending build with no dependencies for SYSTEM that has the
 highest priority (lowest integer value)."
-  (with-db-connection db
-    (match (expect-one-row
-            ;; Note: Keep ordering in sync with that of the
-            ;; 'status+submission-time' filter of 'db-get-builds'.
-            (exec-query/bind db "
+  ;; To maximize responsiveness and build throughput when using
+  ;; 'remote-server', this query must not take too long.
+  (with-timing-check (format #f "getting pending '~a' builds" system)
+    (with-db-connection db
+      (match (expect-one-row
+              ;; Note: Keep ordering in sync with that of the
+              ;; 'status+submission-time' filter of 'db-get-builds'.
+              (exec-query/bind db "
 WITH pending_dependencies AS
 (SELECT Builds.id, count(dep.id) as deps FROM Builds
 LEFT JOIN BuildDependencies as bd ON bd.source = Builds.id
@@ -1645,8 +1648,9 @@ WHERE Builds.status = " (build-status scheduled)
 " GROUP BY Builds.id
 ORDER BY Builds.priority ASC, Builds.timestamp ASC)
 SELECT id FROM pending_dependencies WHERE deps = 0 LIMIT 1;"))
-      ((id) (db-get-build (string->number id)))
-      (else #f))))
+        ((id) (db-get-build (string->number id)))
+        (else #f)))
+    #:threshold 20))
 
 (define-record-type* <checkout> checkout make-checkout
   checkout?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]