fix: improve database health check error reporting and correctness [Backport release/0.5.z]#2417
Merged
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideBackport that improves health check error propagation, logging, and lifetime management so database health checks remain accurate and retained even when the infrastructure endpoint is disabled. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
spawn_db_check, now thatunwrap_or(false)maps any error to a failed check, consider logging the underlying error before returningfalseso that failures during check registration/setup are observable. - In
Infrastructure::runwhen the endpoint is disabled, the infinite loop usingsleep(Duration::from_secs(3600))would be clearer and easier to tune if the sleep interval were extracted into a named constant.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `spawn_db_check`, now that `unwrap_or(false)` maps any error to a failed check, consider logging the underlying error before returning `false` so that failures during check registration/setup are observable.
- In `Infrastructure::run` when the endpoint is disabled, the infinite loop using `sleep(Duration::from_secs(3600))` would be clearer and easier to tune if the sleep interval were extracted into a named constant.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Log at warn level when the health check future exits so operators can detect a degraded state. Also fix the timeout result handling: the outer .is_ok() discarded the inner ping result, causing a fast database failure to be reported as healthy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit 4d4a6e7)
With Rust edition 2021+ disjoint capture, the async move block in the disabled path did not capture self.health, causing the Arc<HealthChecks> to be dropped immediately. This dropped all registered health checks (including their Shutdown handles), killing the health check loops while the server was still running. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit e8784e5)
a4f9d87 to
196f8fc
Compare
ctron
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Backport of #2416 to
release/0.5.z.Summary by Sourcery
Improve reliability and observability of local health checks and keep health monitoring active when the infrastructure endpoint is disabled.
Bug Fixes: