aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-03-24 17:32:03 +0000
committerChristopher Baines <mail@cbaines.net>2019-03-24 17:35:09 +0000
commit800c8502763186cbbdfe4b195ccb895c5473e97b (patch)
treebe25bdf28a08440aa3aa7ee99d75e9414feb6a53
parent2b1142b4244c8135515bb1825a5faf95606853b4 (diff)
downloaddata-service-800c8502763186cbbdfe4b195ccb895c5473e97b.tar
data-service-800c8502763186cbbdfe4b195ccb895c5473e97b.tar.gz
Switch dynamic-wind for with-throw-handler
Not sure why, but dynamic-wind was causing issues by closing the database connection too early, but with-throw-handler seems to work OK.
-rw-r--r--guix-data-service/web/server.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm
index b220b20..81c59fb 100644
--- a/guix-data-service/web/server.scm
+++ b/guix-data-service/web/server.scm
@@ -33,11 +33,13 @@
(define (with-postgresql-connection paramstring f)
(let* ((conn (connect-to-postgres-paramstring paramstring)))
- (dynamic-wind
- (const #t)
- (lambda ()
- (f conn))
+ (with-throw-handler
+ #t
(lambda ()
+ (let ((result (f conn)))
+ (pg-conn-finish conn)
+ result))
+ (lambda (key . args)
(pg-conn-finish conn)))))
(define (run-controller controller request body)