fix: clear analytics queue on callback errors#8934
Open
gauthierpetetin wants to merge 2 commits into
Open
Conversation
7 tasks
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.
Explanation
Clear persisted analytics queue entries once the platform adapter delivery callback fires, even when the callback receives an error. This aligns queue cleanup behavior with the previous Segment-backed MetaMetrics flow and avoids repeatedly replaying malformed or permanently failing events on restart.
References
NA
For example:
Checklist
Note
Medium Risk
Changes when persisted analytics events are dropped versus retried; events reported as failed by the adapter will not be re-sent after restart, which is intentional but affects delivery reliability semantics.
Overview
When persisted event-queue delivery runs,
AnalyticsControllernow removes queued entries as soon as the platform adapter’s delivery callback fires, including when the callback passes an error. Failed deliveries are still logged; the queue is no longer left intact for those cases.That matches prior Segment-backed MetaMetrics behavior and stops replaying events that already failed delivery (for example malformed or permanently rejected payloads) on the next startup. Queued items are still retained if the adapter throws synchronously before the callback runs.
Tests and the package changelog were updated for the new cleanup behavior.
Reviewed by Cursor Bugbot for commit 18ab987. Bugbot is set up for automated code reviews on this repo. Configure here.