diff options
author | Christopher Baines <mail@cbaines.net> | 2021-06-09 09:15:37 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-06-09 09:15:37 +0100 |
commit | 6469778f219f3a96022f98a1c1e313b73307e58c (patch) | |
tree | 784268c84cc2673c4f5d9a565933cfe60b796e6e | |
parent | 93a0b224cc06ec358cab63a9a88c5eab44d4f4fd (diff) | |
download | build-coordinator-6469778f219f3a96022f98a1c1e313b73307e58c.tar build-coordinator-6469778f219f3a96022f98a1c1e313b73307e58c.tar.gz |
Support the work queue matching threads to jobs
-rw-r--r-- | guix-build-coordinator/utils.scm | 15 |
1 files 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 |