Repository navigation
Connect Render services to managed Redis - #6
Merged
Merged
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.
Why
The deployed worker never connected to Redis. Render logs:
Three production modules each built their own Redis client:
utils/jobQueue.jsREDIS_URL→ host/portworker.jsroutes/healthRoutes.jsREDIS_URLsupport was added to the queue alone. On Render onlyREDIS_URLis set, so the workerand the health probe both fell through to the
localhost:6379default. The API looked healthy whilePDF indexing,
SYNC_ATTEMPTand review-queue rebuilds silently went unprocessed.The fix, and why it is shaped this way
The bug was not that one site had wrong logic — it was that three sites each had their own. So
rather than correct two copies, all three now call one resolver:
REDIS_URLwins deliberately. On a managed platform it is the only value set, and preferring alocalhost default there produces a failure that looks like a network problem rather than a
misconfiguration.
REDIS_HOST/REDIS_PORTremain for Compose and local development. Per-siteoptions (
maxRetriesPerRequest,lazyConnect,connectTimeout,retryStrategy) still pass throughuntouched, so the health probe keeps its 1s timeout and
no-retrybehaviour.No change to the Blueprint, the free-tier topology, or the
fromService→REDIS_URLdesign.Tests
New
backend/tests/unit/redisConnection.test.js— 6 tests, the first coverage this path has ever had:REDIS_URLwhen the platform provides oneREDIS_URLeven when host and port are also set — the exact regressionlocalhost:6379when nothing is configuredutils/redisConnection.jsis the only module in production thatconstructs a Redis client — so a fourth site cannot reintroduce the split
Verified in the failing configuration
Not just "tests pass" — the deployed shape was reproduced.
REDIS_HOSTandREDIS_PORTweregenuinely absent (Compose's
environmenthad to be!overrided, because it merges rather thanreplaces — the first attempt at this test silently kept host/port set and proved nothing):
And a real job through that same process:
Regression gate
npm run typechecknpm run buildnpm run lintAfter merging
Redeploy the API service from the new
main. Expect:ECONNREFUSED 127.0.0.1:6379🚀 Worker connected to MongoDBfollowed byCombined API + worker process ready./api/v1/healthreportingredis: connectedHolding off on domain configuration and the production smoke test until the worker is confirmed
consuming jobs.