Improve exception reporting in the resource pool
This commit is contained in:
parent
823cd95628
commit
dc98ef9dcc
1 changed files with 266 additions and 242 deletions
|
@ -200,17 +200,7 @@
|
||||||
channel
|
channel
|
||||||
(list 'return-failed-checkout resource)))))))
|
(list 'return-failed-checkout resource)))))))
|
||||||
|
|
||||||
(spawn-fiber
|
(define (main-loop)
|
||||||
(lambda ()
|
|
||||||
(when idle-seconds
|
|
||||||
(spawn-fiber
|
|
||||||
(lambda ()
|
|
||||||
(while #t
|
|
||||||
(sleep idle-seconds)
|
|
||||||
(put-message channel '(check-for-idle-resources))))))
|
|
||||||
|
|
||||||
(with-throw-handler #t
|
|
||||||
(lambda ()
|
|
||||||
(let loop ((resources '())
|
(let loop ((resources '())
|
||||||
(available '())
|
(available '())
|
||||||
(waiters '())
|
(waiters '())
|
||||||
|
@ -449,9 +439,43 @@
|
||||||
available
|
available
|
||||||
waiters
|
waiters
|
||||||
resources-last-used)))))
|
resources-last-used)))))
|
||||||
(lambda (key . args)
|
|
||||||
(simple-format (current-error-port)
|
(spawn-fiber
|
||||||
"exception in the ~A pool fiber\n" name))))
|
(lambda ()
|
||||||
|
(when idle-seconds
|
||||||
|
(spawn-fiber
|
||||||
|
(lambda ()
|
||||||
|
(while #t
|
||||||
|
(sleep idle-seconds)
|
||||||
|
(put-message channel '(check-for-idle-resources))))))
|
||||||
|
|
||||||
|
(with-exception-handler
|
||||||
|
(lambda (exn)
|
||||||
|
#f)
|
||||||
|
(lambda ()
|
||||||
|
(with-exception-handler
|
||||||
|
(lambda (exn)
|
||||||
|
(let* ((stack (make-stack #t))
|
||||||
|
(error-string
|
||||||
|
(call-with-output-string
|
||||||
|
(lambda (port)
|
||||||
|
(simple-format
|
||||||
|
port
|
||||||
|
"exception in the ~A pool fiber, " name)
|
||||||
|
(print-exception
|
||||||
|
port
|
||||||
|
(stack-ref stack 3)
|
||||||
|
'%exception
|
||||||
|
(list exn))
|
||||||
|
(display-backtrace stack port 3)))))
|
||||||
|
(display error-string
|
||||||
|
(current-error-port)))
|
||||||
|
(raise-exception exn))
|
||||||
|
(lambda ()
|
||||||
|
(start-stack
|
||||||
|
#t
|
||||||
|
(main-loop)))))
|
||||||
|
#:unwind? #t))
|
||||||
(or scheduler
|
(or scheduler
|
||||||
(current-scheduler)))
|
(current-scheduler)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue