From 6469778f219f3a96022f98a1c1e313b73307e58c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 9 Jun 2021 09:15:37 +0100 Subject: Support the work queue matching threads to jobs --- guix-build-coordinator/utils.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index bc18081..7504559 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -684,9 +684,18 @@ References: ~a~%" (running-job-args (make-hash-table))) (define get-thread-count - (if (number? thread-count-parameter) - (const thread-count-parameter) - thread-count-parameter)) + (cond + ((number? thread-count-parameter) + (const thread-count-parameter)) + ((eq? thread-count-parameter #f) + ;; Run one thread per job + (lambda () + (+ (q-length queue) + (hash-count (lambda (index val) + (list? val)) + running-job-args)))) + (else + thread-count-parameter))) (define (process-job . args) (with-mutex queue-mutex -- cgit v1.2.3