Repository navigation
fix: recover pulses lost to process death with a daily catch-up sweep - #654
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.
Summary
A production brand's Daily Pulse silently disappeared for a day: its tracking run completed and stamped, but the per-brand pulse trigger — fire-and-forget at the end of the tracking job — died with the process (memory pressure on a 1 GB host). The stamp survives in the DB; the in-memory trigger doesn't. No error, no mail, nothing to retry.
Fix: a catch-up sweep at the start of every daily cycle.
runPulseCatchUp()scans the last 36h of completedtracking_runs; any brand whose latest completed run has nosent_pulsesrow created after it gets a recovery pulse.generatePulseForBrandgains an optionalpulseDateoverride), so it claims that day's dedupe slot — today's real pulse, fired when today's run completes, keeps its own date and is never suppressed.sent_pulses (brand_id, pulse_date)unique constraint remains the race-safe claim.Related issue
None — production incident fix (missed pulse after an OOM-killed trigger).
Type of change
fix— Bug fixHow to test
sent_pulsesrow for that date, then invokerunPulseCatchUp()— a recovery pulse is generated dated to the run's completion day ([pulse] catch-up pulse sentlog).already_sentvia the unique key).Checklist
fix/)yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)