aboutsummaryrefslogtreecommitdiff
path: root/bffe.scm
diff options
context:
space:
mode:
Diffstat (limited to 'bffe.scm')
-rw-r--r--bffe.scm27
1 files changed, 21 insertions, 6 deletions
diff --git a/bffe.scm b/bffe.scm
index e190ead..d0388f3 100644
--- a/bffe.scm
+++ b/bffe.scm
@@ -22,6 +22,12 @@
#:use-module (prometheus)
#:use-module (logging logger)
#:use-module (logging port-log)
+ #:use-module (fibers)
+ #:use-module (fibers scheduler)
+ #:use-module (fibers channels)
+ #:use-module (fibers conditions)
+ #:use-module ((guix-build-coordinator utils fibers)
+ #:select (call-with-sigint))
#:use-module (bffe server)
#:use-module (bffe manage-builds)
#:export (run-bffe-service))
@@ -51,10 +57,19 @@
(open-log! lgr)
(set-default-logger! lgr)
- (for-each start-submit-builds-thread
- build)
+ (let ((finished? (make-condition)))
+ (call-with-sigint
+ (lambda ()
+ (run-fibers
+ (lambda ()
+ (for-each start-submit-builds-fibers
+ build)
- (apply start-bffe-web-server
- `(,@web-server-args
- #:pid-file ,pid-file
- #:metrics-registry ,metrics-registry))))
+ (apply start-bffe-web-server
+ `(,@web-server-args
+ #:pid-file ,pid-file
+ #:metrics-registry ,metrics-registry))
+ (wait finished?))
+ #:hz 10
+ #:parallelism 4))
+ finished?))))