[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Use the connection pool for build events
From: |
Christopher Baines |
Subject: |
branch master updated: Use the connection pool for build events |
Date: |
Wed, 23 Aug 2023 07:20:44 -0400 |
This is an automated email from the git hooks/post-receive script.
cbaines pushed a commit to branch master
in repository data-service.
The following commit(s) were added to refs/heads/master by this push:
new f2e2ca7 Use the connection pool for build events
f2e2ca7 is described below
commit f2e2ca7a074f4b05c77f3c9f4362091b64c1b8e5
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Wed Aug 23 12:19:22 2023 +0100
Use the connection pool for build events
I'm not sure why this wasn't the way it worked previously. This should avoid
unconstrained use of PostgreSQL connections.
---
guix-data-service/web/build-server/controller.scm | 32 +++++++++++------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/guix-data-service/web/build-server/controller.scm
b/guix-data-service/web/build-server/controller.scm
index ca03284..911e41d 100644
--- a/guix-data-service/web/build-server/controller.scm
+++ b/guix-data-service/web/build-server/controller.scm
@@ -121,23 +121,21 @@
(define (spawn-fiber-for-handler handler)
(spawn-fiber
(lambda ()
- (with-postgresql-connection
- "build-event-handler-conn"
- (lambda (conn)
- (with-exception-handler
- (lambda (exn)
- (simple-format
- (current-error-port)
- "exception in build event handler: ~A\n"
- exn))
- (lambda ()
- (with-throw-handler #t
- (lambda ()
- (handler conn))
- (lambda _
- (display (backtrace) (current-error-port))
- (display "\n" (current-error-port)))))
- #:unwind? #t))))))
+ (with-resource-from-pool (connection-pool) conn
+ (with-exception-handler
+ (lambda (exn)
+ (simple-format
+ (current-error-port)
+ "exception in build event handler: ~A\n"
+ exn))
+ (lambda ()
+ (with-throw-handler #t
+ (lambda ()
+ (handler conn))
+ (lambda _
+ (display (backtrace) (current-error-port))
+ (display "\n" (current-error-port)))))
+ #:unwind? #t)))))
(define (with-build-ids-for-status data
build-ids
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Use the connection pool for build events,
Christopher Baines <=