2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

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.
This commit is contained in:
Christopher Baines 2019-03-24 17:32:03 +00:00
parent 2b1142b424
commit 800c850276
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -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)