aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-10-14 13:12:53 +0100
committerChristopher Baines <mail@cbaines.net>2024-10-14 13:12:53 +0100
commit037eac0357baa448afe6aeeaf82d8f2e2665bbcb (patch)
tree95c574c9f23d5fdbbbafb338c54500258c4fa8d4 /guix-build-coordinator/datastore
parent2f826346449bcc9dbdd7e5368a366ded68b2d32b (diff)
downloadbuild-coordinator-master.tar
build-coordinator-master.tar.gz
Try to prioritise some database operationsHEADmaster
At the moment, hooks can get stuck behind new builds being submitted due to the slow writes. Try to manage this by prioritising the write operations from the hooks.
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index ac04362..1effb39 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -109,6 +109,7 @@
worker-reader-thread-channel
worker-reader-thread-proc-vector
worker-writer-thread-channel
+ worker-priority-writer-thread-channel
worker-writer-thread-proc-vector
metrics-registry)
@@ -199,6 +200,10 @@
(slot-set! datastore
'worker-writer-thread-channel
channel)
+ ;; This is changed in datastore-spawn-fibers
+ (slot-set! datastore
+ 'worker-priority-writer-thread-channel
+ channel)
(slot-set! datastore
'worker-writer-thread-proc-vector
proc-vector))
@@ -343,11 +348,11 @@ PRAGMA optimize;")
(datastore <sqlite-datastore>))
;; Queue messages to the writer thread, so that they're handled in a first
;; come first served manor
- (slot-set!
- datastore
- 'worker-writer-thread-channel
- (make-queueing-channel
- (slot-ref datastore 'worker-writer-thread-channel)))
+ (let ((high low (make-discrete-priority-queueing-channels
+ (slot-ref datastore 'worker-writer-thread-channel)
+ 2)))
+ (slot-set! datastore 'worker-priority-writer-thread-channel high)
+ (slot-set! datastore 'worker-writer-thread-channel low))
(spawn-fiber
(lambda ()
@@ -3177,7 +3182,7 @@ WHERE id = :id"
(datastore <sqlite-datastore>)
id)
(call-with-worker-thread
- (slot-ref datastore 'worker-writer-thread-channel)
+ (slot-ref datastore 'worker-priority-writer-thread-channel)
(lambda (db)
(let ((statement
(sqlite-prepare