aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-04-14 10:04:19 +0100
committerChristopher Baines <mail@cbaines.net>2019-04-14 10:04:51 +0100
commit2e45bb06966a8cab9016afc4b202a056d88c16c3 (patch)
tree94c1e2537308909a351da029a218705204d9d0cf /scripts
parentb352b5040ad028a1415e738212f8b82a5312e0e9 (diff)
downloaddata-service-2e45bb06966a8cab9016afc4b202a056d88c16c3.tar
data-service-2e45bb06966a8cab9016afc4b202a056d88c16c3.tar.gz
Extract out some database functionality to another module
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-data-service-process-branch-updated-email.in12
-rw-r--r--scripts/guix-data-service-process-jobs.in7
-rw-r--r--scripts/guix-data-service-query-build-servers.in3
3 files changed, 12 insertions, 10 deletions
diff --git a/scripts/guix-data-service-process-branch-updated-email.in b/scripts/guix-data-service-process-branch-updated-email.in
index de87dcc..58fb772 100644
--- a/scripts/guix-data-service-process-branch-updated-email.in
+++ b/scripts/guix-data-service-process-branch-updated-email.in
@@ -25,10 +25,12 @@
(ice-9 textual-ports)
(squee)
(email email)
+ (guix-data-service database)
(guix-data-service branch-updated-emails))
-(let ((conn (connect-to-postgres-paramstring "dbname=guix_data_service")))
- (enqueue-job-for-email
- conn
- (parse-email
- (get-string-all (current-input-port)))))
+(with-postgresql-connection
+ (lambda (conn)
+ (enqueue-job-for-email
+ conn
+ (parse-email
+ (get-string-all (current-input-port))))))
diff --git a/scripts/guix-data-service-process-jobs.in b/scripts/guix-data-service-process-jobs.in
index e2e0935..253ed74 100644
--- a/scripts/guix-data-service-process-jobs.in
+++ b/scripts/guix-data-service-process-jobs.in
@@ -27,6 +27,7 @@
(squee)
(guix-data-service jobs))
-(let ((conn (connect-to-postgres-paramstring "dbname=guix_data_service")))
- (simple-format #t "Ready to process jobs...\n")
- (process-jobs conn))
+(with-postgresql-connection
+ (lambda (conn)
+ (simple-format #t "Ready to process jobs...\n")
+ (process-jobs conn)))
diff --git a/scripts/guix-data-service-query-build-servers.in b/scripts/guix-data-service-query-build-servers.in
index e39932b..2451fbf 100644
--- a/scripts/guix-data-service-query-build-servers.in
+++ b/scripts/guix-data-service-query-build-servers.in
@@ -25,5 +25,4 @@
(squee)
(guix-data-service builds))
-(let ((conn (connect-to-postgres-paramstring "dbname=guix_data_service")))
- (query-build-servers conn))
+(with-postgresql-connection query-build-servers)