-
Notifications
You must be signed in to change notification settings - Fork 201
feat: Waiting plugin addition #1110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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>
8bb3074 to
82e2dc1
Compare
- Fix strict-boolean-expressions error in QueueFlushingPlugin.ts - Replace 'any' type with proper ClientWithInternals type in tests - All linting errors resolved
| } | ||
| if (!this.running.get()) { | ||
| // If not running, queue the event for later processing | ||
| await this.store.pendingEvents.add(event); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
add waiting plugin interface.