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.
This commit is contained in:
Christopher Baines 2023-08-23 12:19:22 +01:00
parent 9f102dbd39
commit f2e2ca7a07
1 changed files with 15 additions and 17 deletions

View File

@ -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