diff options
author | Christopher Baines <mail@cbaines.net> | 2023-08-23 12:19:22 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-08-23 12:19:22 +0100 |
commit | f2e2ca7a074f4b05c77f3c9f4362091b64c1b8e5 (patch) | |
tree | 6e765ce1a7c831f13a1b1561ec22ae5fa868b518 /guix-data-service/web | |
parent | 9f102dbd39c0c317a21b2d0eb84acce2242fb41f (diff) | |
download | data-service-f2e2ca7a074f4b05c77f3c9f4362091b64c1b8e5.tar data-service-f2e2ca7a074f4b05c77f3c9f4362091b64c1b8e5.tar.gz |
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.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r-- | guix-data-service/web/build-server/controller.scm | 32 |
1 files 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 |