Skip to content

Conversation

@sunitaprajapati89
Copy link
Contributor

add waiting plugin interface.

  • any plugin implement this interface will pause event processing when it's added to analytics
  • any plugin implement this interface can pause and resume event processing as needed

@abueide
Copy link
Contributor

abueide commented Feb 12, 2026

@claude
@copilot
can you implement the review comments in this PR?

Copy link

Copilot AI commented Feb 12, 2026

@abueide I've opened a new pull request, #1123, to work on those changes. Once the pull request is ready, I'll request review from you.

Implements WaitingPlugin functionality that allows plugins to pause event
processing until async operations complete (e.g., permissions, SDK initialization).

Key features:
- WaitingPlugin base class with pause/resume methods
- Automatic event buffering when paused
- Support for multiple waiting plugins
- 30-second timeout to prevent permanent blocking
- Works with both root-level and destination plugins

Implementation details:
- Add running state to storage (separate from enabled)
- Events queued when running=false
- Process pending events when all waiting plugins resume
- QueueFlushingPlugin respects running state

Includes comprehensive tests and documentation with real-world examples
(IDFA permissions, native SDK initialization, remote config loading).

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix strict-boolean-expressions error in QueueFlushingPlugin.ts
- Replace 'any' type with proper ClientWithInternals type in tests
- All linting errors resolved
@abueide abueide self-assigned this Feb 12, 2026
}
if (!this.running.get()) {
// If not running, queue the event for later processing
await this.store.pendingEvents.add(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be redundant with the if block in line 520

const event = await this.applyContextData(incomingEvent);
this.flushPolicyExecuter.notify(event);
return this.timeline.process(event);
return await this.timeline.process(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await is redundant here

async flush() {
// Check if event processing is running
const running = this.analytics?.running.get();
if (running === false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a change in behavior. pipeline should still be able to flush. running only disables new event being tracked

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.

5 participants