aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-12-07 20:51:35 +0000
committerChristopher Baines <mail@cbaines.net>2020-12-07 20:51:35 +0000
commitc8e6da7680688d1c92fde696f8f5938d97b163ea (patch)
treecd6d83450d1f5fea9d40e7a03194af825bdc9cfb /guix-build-coordinator/datastore
parent2673ff15710d68fd0a1717e762f33fbfa07554e2 (diff)
downloadbuild-coordinator-c8e6da7680688d1c92fde696f8f5938d97b163ea.tar
build-coordinator-c8e6da7680688d1c92fde696f8f5938d97b163ea.tar.gz
Use a readonly connection for the SQLite readers
This seems sensible.
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 17f5a66..5038fa0 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -102,7 +102,7 @@
(make-worker-thread-channel
(lambda ()
(let ((db
- (db-open database-file)))
+ (db-open database-file #:write? #f)))
(sqlite-exec db "PRAGMA journal_mode=WAL;")
(sqlite-exec db "PRAGMA busy_timeout = 5000;")
(list db)))
@@ -2135,9 +2135,12 @@ WHERE build_results.build_id = :build_id"
result)))))
-(define (db-open database)
+(define* (db-open database
+ #:key (write? #t))
(define flags
- (list SQLITE_OPEN_READWRITE
+ (list (if write?
+ SQLITE_OPEN_READWRITE
+ SQLITE_OPEN_READONLY)
SQLITE_OPEN_NOMUTEX))
(unless (file-exists? database)