aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage
diff options
context:
space:
mode:
Diffstat (limited to 'guix-qa-frontpage')
-rw-r--r--guix-qa-frontpage/database.scm62
1 files changed, 32 insertions, 30 deletions
diff --git a/guix-qa-frontpage/database.scm b/guix-qa-frontpage/database.scm
index 5649c36..51c0255 100644
--- a/guix-qa-frontpage/database.scm
+++ b/guix-qa-frontpage/database.scm
@@ -465,39 +465,41 @@ SELECT data, timestamp FROM cache WHERE key = :key"
(when (if (procedure? store-computed-value?)
(apply store-computed-value? vals)
store-computed-value?)
- (database-call-with-transaction
- database
- (lambda (db)
- (let ((cleanup-statement
- (sqlite-prepare
- db
- "
+ (let ((vals-string
+ (call-with-output-string
+ (lambda (port)
+ (write vals port)))))
+ (database-call-with-transaction
+ database
+ (lambda (db)
+ (let ((cleanup-statement
+ (sqlite-prepare
+ db
+ "
DELETE FROM cache WHERE key = :key"
- #:cache? #t))
- (insert-statement
- (sqlite-prepare
- db
- "
+ #:cache? #t))
+ (insert-statement
+ (sqlite-prepare
+ db
+ "
INSERT INTO cache (key, timestamp, data)
VALUES (:key, :timestamp, :data)"
- #:cache? #t)))
-
- (sqlite-bind-arguments
- cleanup-statement
- #:key string-key)
- (sqlite-step cleanup-statement)
- (sqlite-reset cleanup-statement)
-
- (sqlite-bind-arguments
- insert-statement
- #:key string-key
- #:timestamp (time-second (current-time))
- #:data (call-with-output-string
- (lambda (port)
- (write vals port))))
-
- (sqlite-step insert-statement)
- (sqlite-reset insert-statement)))))
+ #:cache? #t)))
+
+ (sqlite-bind-arguments
+ cleanup-statement
+ #:key string-key)
+ (sqlite-step cleanup-statement)
+ (sqlite-reset cleanup-statement)
+
+ (sqlite-bind-arguments
+ insert-statement
+ #:key string-key
+ #:timestamp (time-second (current-time))
+ #:data vals-string)
+
+ (sqlite-step insert-statement)
+ (sqlite-reset insert-statement))))))
(apply values vals)))
(apply values cached-values))))