Skip to content

feat: add defensive queue to _sendEventStream to prevent event loss#75

Draft
crisryantan wants to merge 1 commit intomparticle-integrations:mainfrom
crisryantan:feature/event-stream-defensive-queue
Draft

feat: add defensive queue to _sendEventStream to prevent event loss#75
crisryantan wants to merge 1 commit intomparticle-integrations:mainfrom
crisryantan:feature/event-stream-defensive-queue

Conversation

@crisryantan
Copy link
Contributor

Summary

  • Adds an eventStreamQueue buffer in _sendEventStream so that events are queued (instead of silently dropped) when window.Rokt.__event_stream__ is not yet available
  • Queued events are flushed in FIFO order once __event_stream__ becomes available on the next processEvent call
  • This is a defensive measure to close the gap where events could be lost if the Rokt WSDK hasn't fully initialized when the kit forwards them

Test plan

  • Updated existing tests ("should not throw when __event_stream__ is not defined" and "should not throw when window.Rokt is undefined") to verify events are queued rather than dropped
  • Added test: "should flush queued events in FIFO order when __event_stream__ becomes available"
  • Verify all 128 tests pass in CI

Made with Cursor

Buffer events in eventStreamQueue when window.Rokt.__event_stream__
is not yet available, and flush them in FIFO order once it is.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant