Log resource pool stats on errors

This commit is contained in:
Christopher Baines 2025-01-06 19:31:54 +00:00
parent 52a307612f
commit d6cfd780e8

View file

@ -35,6 +35,7 @@
#:use-module (texinfo html) #:use-module (texinfo html)
#:use-module (squee) #:use-module (squee)
#:use-module (json) #:use-module (json)
#:use-module (fibers)
#:use-module (knots parallelism) #:use-module (knots parallelism)
#:use-module (knots resource-pool) #:use-module (knots resource-pool)
#:use-module (prometheus) #:use-module (prometheus)
@ -721,6 +722,16 @@
(with-exception-handler (with-exception-handler
(lambda (exn) (lambda (exn)
(when (resource-pool-timeout-error? exn)
(spawn-fiber
(lambda ()
(let* ((pool (resource-pool-timeout-error-pool exn))
(stats (resource-pool-stats pool)))
(simple-format (current-error-port)
"resource pool timeout error: ~A, ~A\n"
pool
stats)))))
(case (most-appropriate-mime-type (case (most-appropriate-mime-type
mime-types mime-types
'(text/html application/json)) '(text/html application/json))