Skip to content

Propagate CancellationException from Mongo/Rabbit/Elastic/Pulsar checks - #256

Open
sksamuel wants to merge 1 commit into
mainfrom
fix/multi-checks-propagate-cancellation
Open

Propagate CancellationException from Mongo/Rabbit/Elastic/Pulsar checks#256
sksamuel wants to merge 1 commit into
mainfrom
fix/multi-checks-propagate-cancellation

Conversation

@sksamuel

Copy link
Copy Markdown
Owner

Five health checks were swallowing CancellationException via runCatching. Switch to try/catch with explicit rethrow.

🤖 Generated with Claude Code

Five health checks used `runCatching { ... }.getOrElse { unhealthy(...) }`
to convert any throwable into Unhealthy. `runCatching` catches
`CancellationException` and `TimeoutCancellationException`, so registry
shutdown and check-timeout signals were converted into fake failure
results, breaking structured concurrency.

- cohort-mongo/.../GenericMongoConnectionHealthCheck
- cohort-rabbit/.../RabbitConnectionHealthCheck
- cohort-rabbit/.../RabbitQueueHealthCheck
- cohort-elastic/.../ElasticClusterCommandCheck
- cohort-pulsar/.../PulsarHealthCheck

Switch each to try/catch with explicit `CancellationException` rethrow.
Where a `withTimeout` is involved, special-case
`TimeoutCancellationException` for a clearer "(timed out)" message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant