Actually close database connections

Previously, the connections were not closed, so eventually PostgreSQL
would run out. Using a pool of connections would be better, but as a
short term solution, just close the connection after each request.
This commit is contained in:
Christopher Baines 2019-02-08 11:19:12 +00:00
parent 5a9262b38d
commit 0a49c0a84a
Signed by: cbaines
GPG key ID: 5E28A33B0B84F577
2 changed files with 21 additions and 6 deletions

View file

@ -50,9 +50,7 @@
;; (render-html (error-page message))))
)
(define (controller request body)
(define conn (connect-to-postgres-paramstring "dbname=guix_data_service"))
(define (controller request body conn)
(match-lambda
((GET)
(apply render-html (index (most-recent-n-guix-revisions conn 10))))