aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/database.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-12 19:45:41 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-12 19:49:26 +0100
commit743cec7cb675dc6cc792a01daf898c011fc20fc7 (patch)
tree2040ed787544470a2525307e2f7479d3f29e5a90 /guix-data-service/database.scm
parent1b5db7adac298e4f0d7e6c9024fc31ebabb4a994 (diff)
downloaddata-service-743cec7cb675dc6cc792a01daf898c011fc20fc7.tar
data-service-743cec7cb675dc6cc792a01daf898c011fc20fc7.tar.gz
Associate a name with database connections
This helps when working out which connection to the database is doing what.
Diffstat (limited to 'guix-data-service/database.scm')
-rw-r--r--guix-data-service/database.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/guix-data-service/database.scm b/guix-data-service/database.scm
index ab6758b..acc6dea 100644
--- a/guix-data-service/database.scm
+++ b/guix-data-service/database.scm
@@ -24,10 +24,12 @@
(define pg-conn-finish
(@@ (squee) pg-conn-finish))
-(define (with-postgresql-connection f)
+(define* (with-postgresql-connection name f)
(define paramstring
- (or (getenv "GUIX_DATA_SERVICE_DATABASE_PARAMSTRING")
- "dbname=guix_data_service user=guix_data_service"))
+ (string-append
+ (or (getenv "GUIX_DATA_SERVICE_DATABASE_PARAMSTRING")
+ "dbname=guix_data_service user=guix_data_service")
+ " application_name='guix-data-service " name "'"))
(let* ((conn (connect-to-postgres-paramstring paramstring)))
(with-throw-handler