diff options
Diffstat (limited to 'guix-build-coordinator/datastore/sqlite.scm')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index 90fd3b6..97cd65b 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -253,11 +253,6 @@ CREATE TABLE IF NOT EXISTS mem.build_allocation_plan ( (sqlite-reset statement) val)) -(define (sqlite-step-and-finalize statement) - (let ((val (sqlite-step statement))) - (sqlite-finalize statement) - val)) - (define* (db-optimize db db-filename metrics-registry #:key (maybe-truncate-wal? #t)) (define (wal-size) @@ -291,9 +286,10 @@ CREATE TABLE IF NOT EXISTS mem.build_allocation_plan ( (let* ((statement (sqlite-prepare db - "PRAGMA wal_checkpoint(TRUNCATE);")) + "PRAGMA wal_checkpoint(TRUNCATE);" + #:cache? #t)) (result - (match (sqlite-step-and-finalize statement) + (match (sqlite-step-and-reset statement) (#(blocked? modified-page-count pages-moved-to-db) (if (= blocked? 1) (begin @@ -778,13 +774,13 @@ SELECT id, name, description, active FROM agents ORDER BY id" db " UPDATE agents SET active = :active WHERE id = :uuid" - #:cache? #f))) + #:cache? #t))) (sqlite-bind-arguments statement #:uuid agent-uuid #:active (if active? 1 0)) - (sqlite-step-and-finalize statement)))) + (sqlite-step-and-reset statement)))) active?) (define-method (datastore-find-agent-status @@ -2508,7 +2504,7 @@ WHERE derivation_outputs.derivation_id = builds.derivation_id)")) (string-append "LIMIT " (number->string limit) "\n") ""))) (statement - (sqlite-prepare db query #:cache? #f))) + (sqlite-prepare db query #:cache? #t))) (when after-id (sqlite-bind-arguments @@ -2559,7 +2555,7 @@ WHERE derivation_outputs.derivation_id = builds.derivation_id)")) uuid)))) #f))))) statement))) - (sqlite-finalize statement) + (sqlite-reset statement) result))))))) |