fix: check Redis connectivity in /ready health probe - #1513
Open
Jayycob2211 wants to merge 4 commits into
Open
Jayycob2211 wants to merge 4 commits into
Jayycob2211 wants to merge 4 commits into
Conversation
|
@Jayycob2211 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This branch has not been deployed
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.
Overview
This PR closes a readiness gap where
/readyreported healthy even when Redis was unreachable. A pod with a dead cache connection would keep receiving traffic from k8s, and anyGET /vaultsrequest hitting the cache path would throw 500 and fall back to the DB, causing a thundering herd. The/readyprobe now pings Redis (with a 500ms timeout) and returns 503 when it fails, while treating Redis as optional whenREDIS_URLis not configured.Related Issue
Changes
🩺 Redis Readiness Check
[MODIFY]
backend/src/redisCache.tsping()helper that performs a RedisPINGwith a 500ms timeout so the health probe can verify cache connectivity.REDIS_URLset) so callers can distinguish "optional and absent" from "configured but down".[MODIFY]
backend/src/healthProbe.tsredisentry to the/readychecks.redis.ping(); on failure return 503 withchecks: { redis: { status: 'down' } }.REDIS_URLis not set, reportchecks: { redis: { status: 'up', optional: true } }instead ofdown.[MODIFY]
backend/src/__tests__/healthReady.test.ts/readycontract tests to assert the newredischeck is present.redis.pingto throw and asserts/readyresponds 503.REDIS_URLunset →upwithoptional: true).[MODIFY]
backend/schema-snapshots/get-_ready.json/readyresponse snapshot to include theredischeck.Verification Results
redis.ping()check with 500ms timeout to/ready; return 503 withchecks: {redis: {status: 'down'}}on failurehealthProbe.ts/redisCache.tsREDIS_URLnot set) reportsupwithoptional: trueredischeckhealthReady.test.ts+get-_ready.jsonupdatedredis.pingto throw and assert/readyis 503healthReady.test.tsCloses #1443