aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/substitutes.scm9
-rw-r--r--guix-data-service/web/server.scm3
-rw-r--r--scripts/guix-data-service.in2
3 files changed, 12 insertions, 2 deletions
diff --git a/guix-data-service/substitutes.scm b/guix-data-service/substitutes.scm
index c7a45dc..3603521 100644
--- a/guix-data-service/substitutes.scm
+++ b/guix-data-service/substitutes.scm
@@ -19,6 +19,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (ice-9 match)
+ #:use-module (ice-9 atomic)
#:use-module (ice-9 threads)
#:use-module (fibers)
#:use-module (fibers channels)
@@ -149,7 +150,7 @@
(lambda (channel)
(put-message channel (cons build-server-id build-ids)))))))
-(define (start-substitute-query-threads)
+(define (start-substitute-query-threads startup-completed?)
(define channel
(make-channel))
@@ -162,6 +163,9 @@
(set-thread-name "request substitute query"))
(const #t))
+ (while (not (atomic-box-ref startup-completed?))
+ (sleep 1))
+
(while #t
(with-exception-handler
(lambda (exn)
@@ -208,6 +212,9 @@
(set-thread-name "bulk substitute query"))
(const #t))
+ (while (not (atomic-box-ref startup-completed?))
+ (sleep 1))
+
(while #t
(with-exception-handler
(lambda (exn)
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm
index 77db774..4e08161 100644
--- a/guix-data-service/web/server.scm
+++ b/guix-data-service/web/server.scm
@@ -260,6 +260,9 @@ port. Also, the port used can be changed by passing the --port option.\n"
(spawn-fiber
(lambda ()
+ (while (not (check-startup-completed startup-completed))
+ (sleep 1))
+
(with-resource-from-pool (background-connection-pool) conn
(backfill-guix-revision-package-derivation-distribution-counts
conn)))
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in
index 8a124ee..172838f 100644
--- a/scripts/guix-data-service.in
+++ b/scripts/guix-data-service.in
@@ -197,7 +197,7 @@
(lambda (port)
(simple-format port "~A\n" (getpid)))))
- (start-substitute-query-threads)
+ (start-substitute-query-threads startup-completed)
(call-with-new-thread
(lambda ()