fix(journeys): warm active-journey cache at boot + read-through findActive (EVO-1927)#102
Merged
dpaes merged 1 commit intoJun 25, 2026
Conversation
There was a problem hiding this comment.
Sorry @daniloleonecarneiro, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
dpaes
approved these changes
Jun 25, 2026
dpaes
left a comment
There was a problem hiding this comment.
Approved — deep adversarial review (card + authoritative diff + real code): acceptance criteria met, no blocking findings. Merge intentionally held to land in the coordinated dependency-order pass. Branch is clean vs develop.
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
Regression: after an evo-flow restart,
JourneysService.findActive()read from an empty/stale Redis active-journey index (no warm-up on boot). TheJourneyTriggerProcessorthen matched every event against ZERO journeys, so event-based triggers died silently on each deploy (Found 0 active journeyswhile Postgres had 56 active). Manual triggers were unaffected (they bypass the cache).Two layers of defense:
JourneysService.warmActiveJourneysCache()loads active journeys from Postgres and populates the cache. TheJourneyTriggerProcessorcalls it inonModuleInitBEFORE subscribing tojourney-triggers, so the first event matches the real journey set. Best-effort: a warm-up failure does not block the consumer.findActive()— on a cache miss (cache returns 0), fall through to the DB as source of truth and repopulate the cache so subsequent reads hit Redis again.Test plan
npx tsc -bclean.npx jestonjourneys.service.spec.ts+journey-trigger-processor.service.spec.ts: 24/24 green.Notas