Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make registering handlers resilient to synchronous exceptions #42

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

adinapoli
Copy link
Contributor

Fixes #40.

This PR refactors registerMetrics by wrapping each handler's registration function with a tryRegister combinator which will catch synchronous exception which might be raised during registration, avoiding that a single failed registration causes the whole ridley thread to abort.

It's slightly unsatisfactory that the Wai case is a bit of an outlier there, but fixing that would require (I suspect), some more thorough refactoring. I wonder if I should just remove Wai data constructor and simply implement it as a CustomMetric, which might be better here. See also #23 .

This commit wraps every effectful block inside 'registerMetrics' with
a handler that will try to catch every synchronous exception so that
the whole ridley process won't grind to a halt, but rather the handlers
that failed to register will simply be ignored.
@adinapoli adinapoli merged commit cdd3b52 into master Aug 30, 2022
@adinapoli adinapoli deleted the adinapoli/issue-40 branch August 30, 2022 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

registerMetrics should catch exceptions
1 participant