Fix starting with an empty database

This commit is contained in:
Christopher Baines 2024-11-05 21:11:02 +00:00
parent 717b861d31
commit c58ee6726b
3 changed files with 12 additions and 2 deletions

View file

@ -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)

View file

@ -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)))

View file

@ -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 ()