diff options
author | Christopher Baines <mail@cbaines.net> | 2024-10-14 13:12:53 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-10-14 13:12:53 +0100 |
commit | 037eac0357baa448afe6aeeaf82d8f2e2665bbcb (patch) | |
tree | 95c574c9f23d5fdbbbafb338c54500258c4fa8d4 /guix-build-coordinator | |
parent | 2f826346449bcc9dbdd7e5368a366ded68b2d32b (diff) | |
download | build-coordinator-037eac0357baa448afe6aeeaf82d8f2e2665bbcb.tar build-coordinator-037eac0357baa448afe6aeeaf82d8f2e2665bbcb.tar.gz |
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')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 17 |
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 |