Retry unresolved usage events before DLQ#751
Draft
RitwijParmar wants to merge 1 commit into
Draft
Conversation
Welcome, @RitwijParmar!Thanks for your first contribution! Before we proceed with the review, please sign the Fiduciary License Agreement: Once signed, this PR will be automatically updated. |
Thanks, @RitwijParmar! 🎉Your CLA has been signed and is now on file. We'll proceed with the review shortly. |
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
Usage events can arrive before the subscription cache or database view has caught up. Before this change, a non API post-processed event with an external subscription id but no active subscription match could be treated as successfully enriched without a subscription. That risks committing a billable usage event without producing the downstream enriched records needed for billing.
This PR changes that path to a retryable, non-capturable subscription_not_found failure while the event is still inside the retry window. If the event ages out, it goes to the dead letter topic with enough metadata to understand and replay it safely.
What changed:
Validation
I also tried go test -vet=off ./processors/events_processor ./models from events-processor using a temporary Go toolchain. The local machine is almost out of disk space and the build failed before compiling these packages with no space left on device while writing Go build artifacts. The failure was environmental, not a test assertion failure.