guix-commits
[Top][All Lists]
Advanced

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

branch master updated: Add "queue size" argument.


From: Mathieu Othacehe
Subject: branch master updated: Add "queue size" argument.
Date: Tue, 08 Dec 2020 05:46:24 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 697fa14  Add "queue size" argument.
697fa14 is described below

commit 697fa14584551d9595cd042f1ffeba240e45a127
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Dec 7 17:15:22 2020 +0100

    Add "queue size" argument.
    
    * bin/cuirass.in (%options): Add "queue-size" argument.
    (show-help): Document it.
    (main): Honor it.
    * src/cuirass/database.scm (%db-writer-queue-size): New parameter,
    (with-queue-writer-worker): use it.
---
 bin/cuirass.in           | 7 ++++++-
 src/cuirass/database.scm | 7 +++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/bin/cuirass.in b/bin/cuirass.in
index aef4a65..fb0c0fe 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -28,6 +28,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
 
 (use-modules (cuirass)
              (cuirass base)
+             (cuirass database)
              (cuirass ui)
              (cuirass logging)
              (cuirass metrics)
@@ -56,6 +57,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
   -p  --port=NUM            Port of the HTTP server.
       --listen=HOST         Listen on the network interface for HOST
   -I, --interval=N          Wait N seconds between each poll
+  -Q, --queue-size=N        Set the writer queue size to N elements.
       --log-queries=FILE    Log SQL queries in FILE.
       --use-substitutes     Allow usage of pre-built substitutes
       --record-events       Record events for distribution
@@ -74,6 +76,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
     (port           (single-char #\p) (value #t))
     (listen                           (value #t))
     (interval       (single-char #\I) (value #t))
+    (queue-size     (single-char #\Q) (value #t))
     (use-substitutes                  (value #f))
     (threads                          (value #t))
     (fallback                         (value #f))
@@ -104,7 +107,9 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" 
"$@"
          (%fallback? (option-ref opts 'fallback #f))
          (%record-events? (option-ref opts 'record-events #f))
          (%gc-root-ttl
-          (time-second (string->duration (option-ref opts 'ttl "30d")))))
+          (time-second (string->duration (option-ref opts 'ttl "30d"))))
+         (%db-writer-queue-size
+          (string->number (option-ref opts 'queue-size "1"))))
       (cond
        ((option-ref opts 'help #f)
         (show-help)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index c160692..7d9427b 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -97,6 +97,7 @@
             %db-channel
             %db-writer-channel
             %record-events?
+            %db-writer-queue-size
             ;; Macros.
             with-db-worker-thread
             with-db-writer-worker-thread
@@ -203,6 +204,9 @@ specified."
 (define %record-events?
   (make-parameter #f))
 
+(define %db-writer-queue-size
+  (make-parameter #f))
+
 (define-syntax-rule (with-db-worker-thread db exp ...)
   "Evaluate EXP... in the critical section corresponding to %DB-CHANNEL.
 DB is bound to the argument of that critical section: the database connection.
@@ -598,10 +602,9 @@ allocate more than one worker."
                    (lambda ()
                      (list (db-open)))
                    #:parallelism 1
-                   #:queue-size 100
+                   #:queue-size (%db-writer-queue-size)
                    #:queue-proc
                    (lambda (db run-queue)
-                     (log-message "Running writer queue.")
                      (sqlite-exec db "BEGIN TRANSACTION;")
                      (run-queue)
                      (sqlite-exec db "COMMIT;")))))



reply via email to

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