aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-05-16 18:02:15 +0100
committerChristopher Baines <mail@cbaines.net>2024-05-17 14:39:38 +0100
commit30e24683da243304a634e13c2b5774b9a4f1567c (patch)
treebcf589df07b4d510fae9ae209a2765a3ba351455
parentf2766365fbcf528ba702ab1eacb49bae468f3119 (diff)
downloadqa-frontpage-30e24683da243304a634e13c2b5774b9a4f1567c.tar
qa-frontpage-30e24683da243304a634e13c2b5774b9a4f1567c.tar.gz
Queue writes since they seem to be delayed
-rw-r--r--guix-qa-frontpage/database.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/guix-qa-frontpage/database.scm b/guix-qa-frontpage/database.scm
index 51c0255..c44d83a 100644
--- a/guix-qa-frontpage/database.scm
+++ b/guix-qa-frontpage/database.scm
@@ -36,7 +36,8 @@
#:use-module ((guix-build-coordinator utils fibers)
#:select (retry-on-error
make-worker-thread-channel
- call-with-worker-thread))
+ call-with-worker-thread
+ make-queueing-channel))
#:use-module (guix-qa-frontpage guix-data-service)
#:export (setup-database
@@ -62,7 +63,8 @@
database?
(database-file database-file)
(reader-thread-channel database-reader-thread-channel)
- (writer-thread-channel database-writer-thread-channel)
+ (writer-thread-channel database-writer-thread-channel
+ set-database-writer-thread-channel!)
(metrics-registry database-metrics-registry))
(define* (db-open database
@@ -254,6 +256,13 @@ PRAGMA optimize;")))
#:delay 5))
(define (database-spawn-fibers database)
+ ;; Queue messages to the writer thread, so that they're handled in a first
+ ;; come first served manor
+ (set-database-writer-thread-channel!
+ database
+ (make-queueing-channel
+ (database-writer-thread-channel database)))
+
(spawn-fiber
(lambda ()
(while #t