diff options
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 15 | ||||
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 20 |
2 files changed, 29 insertions, 6 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 3d780c4..354cb31 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -65,7 +65,8 @@ (define (start-client-request-server secret-key-base host port - build-coordinator) + build-coordinator + utility-thread-pool-channel) (run-server/patched (lambda (request body) (log-msg (build-coordinator-logger build-coordinator) @@ -80,7 +81,8 @@ (uri-path (request-uri request)))) body secret-key-base - build-coordinator))) + build-coordinator + utility-thread-pool-channel))) #:host host #:port port)) @@ -88,7 +90,8 @@ method-and-path-components raw-body secret-key-base - build-coordinator) + build-coordinator + utility-thread-pool-channel) (define datastore (build-coordinator-datastore build-coordinator)) @@ -483,7 +486,11 @@ (substitute-derivation store derivation-file #:substitute-urls substitute-urls))) - (read-derivation-from-file* derivation-file)) + ;; Read the derivation in a thread to avoid blocking fibers + (call-with-worker-thread + utility-thread-pool-channel + (lambda () + (read-derivation-from-file* derivation-file)))) (let ((submit-build-result (call-with-delay-logging diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 2d7f3d9..59891d1 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -504,7 +504,22 @@ ;; to run-fibers being called. (let ((output-hash-channel (make-output-hash-channel - build-coordinator))) + build-coordinator)) + + (utility-thread-pool-channel + (make-worker-thread-channel + (const '()) + #:name "utility" + #:parallelism 6 + #:delay-logger + (lambda (seconds-delayed) + (log-delay "utility thread channel" + seconds-delayed) + (when (> seconds-delayed 0.1) + (format + (current-error-port) + "warning: utility thread channel delayed by ~1,2f seconds~%" + seconds-delayed)))))) (let ((finished? (make-condition))) (call-with-sigint @@ -575,7 +590,8 @@ secret-key-base (uri-host client-communication-uri) (uri-port client-communication-uri) - build-coordinator) + build-coordinator + utility-thread-pool-channel) ;; Guile seems to just stop listening on ports, so try to ;; monitor that internally and just quit if it happens |