Skip to content

fix: clear analytics queue on callback errors#8934

Open
gauthierpetetin wants to merge 2 commits into
mainfrom
fix/analytics-queue-clear-callback-errors
Open

fix: clear analytics queue on callback errors#8934
gauthierpetetin wants to merge 2 commits into
mainfrom
fix/analytics-queue-clear-callback-errors

Conversation

@gauthierpetetin
Copy link
Copy Markdown
Contributor

@gauthierpetetin gauthierpetetin commented May 29, 2026

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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

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, AnalyticsController now 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.

@gauthierpetetin gauthierpetetin requested a review from a team as a code owner May 29, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant