[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: Extract out opening PostgreSQL connections
From: |
Christopher Baines |
Subject: |
01/06: Extract out opening PostgreSQL connections |
Date: |
Sat, 3 Oct 2020 16:43:17 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 1bdc8855ba0fc78e86131e7f2bafb34984f5e79e
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Oct 3 08:55:56 2020 +0100
Extract out opening PostgreSQL connections
So this can be reused.
---
guix-data-service/database.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/guix-data-service/database.scm b/guix-data-service/database.scm
index 2ac26c4..1d29199 100644
--- a/guix-data-service/database.scm
+++ b/guix-data-service/database.scm
@@ -44,7 +44,7 @@
(define pg-conn-finish
(@@ (squee) pg-conn-finish))
-(define* (with-postgresql-connection name f #:key (statement-timeout #f))
+(define (open-postgresql-connection name statement-timeout)
(define paramstring
(string-append
(or (getenv "GUIX_DATA_SERVICE_DATABASE_PARAMSTRING")
@@ -62,8 +62,13 @@
conn
(simple-format #f "SET statement_timeout = ~A"
statement-timeout)))
+
+ conn))
+
+(define* (with-postgresql-connection name f #:key (statement-timeout #f))
+ (let ((conn (open-postgresql-connection name statement-timeout)))
(with-throw-handler
- #t
+ #t
(lambda ()
(call-with-values
(lambda ()
- branch master updated (470573b -> 55eaaae), Christopher Baines, 2020/10/03
- 01/06: Extract out opening PostgreSQL connections,
Christopher Baines <=
- 02/06: Add some utilities to work with PostgreSQL connections in threads, Christopher Baines, 2020/10/03
- 03/06: Stop opening a PostgreSQL connection per request, Christopher Baines, 2020/10/03
- 05/06: Completely rework the way db connections are handled during requests, Christopher Baines, 2020/10/03
- 04/06: Rework the shortlived PostgreSQL specific connection channel, Christopher Baines, 2020/10/03
- 06/06: Bump the copyright date in the footer, Christopher Baines, 2020/10/03