fix: use redis_url instead of nonexistent redis_host/redis_port in health check#175
Open
grod718 wants to merge 5 commits into
Open
fix: use redis_url instead of nonexistent redis_host/redis_port in health check#175grod718 wants to merge 5 commits into
grod718 wants to merge 5 commits into
Conversation
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.
Summary
Fixes the
/healthendpoint's Redis check, which referenced nonexistentsettings.redis_host/settings.redis_portfields, causing it to silently report Redis as unhealthy on every request regardless of Redis's actual status.Issue
Closes #155
Changes
redis.Redis(host=settings.redis_host, port=settings.redis_port, ...)withredis.Redis.from_url(settings.redis_url, ...)inapi/routes/health.py, matching the only Redis config field that actually exists onSettingstests/unit/test_health_routes.py— the first route-level test in this codebase, covering both the healthy and genuinely-unhealthy Redis pathsTesting
make test-unit) — confirmed viagit stashcomparison that this PR introduces zero new failures; the 53 pre-existing failures in the suite are unrelated to this change (see JOURNAL.md for details)make lint) — pre-existingruffwarning on the untouchedDepends(get_db)default-argument pattern in this file; not introduced by this PRmake typecheck) — pre-existingmypydebt across many unrelated files in this codebase (see JOURNAL.md); this PR introduces zero new mypy errors in files it touchesScreenshots / Demo
curl http://localhost:8000/healthbefore:"redis":"unhealthy"— after:"redis":"healthy"(Redis genuinely healthy the whole time, confirmed viadocker compose ps).Notes for Reviewers
This codebase currently has significant pre-existing test and type-check debt unrelated to this change (documented in
JOURNAL.md) — I verified viagit stashthat none of it is introduced by this PR. Happy to discuss if there's a preferred way to handle themake check/pre-commit gate given this.