Skip to content

Conversation

@sunitaprajapati89
Copy link
Contributor

Enhancement clear queue flush

alanjcharles
alanjcharles previously approved these changes May 13, 2025
Copy link
Contributor

@alanjcharles alanjcharles left a comment

Choose a reason for hiding this comment

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

This would definitely work.

@wenxi-zeng mentioned potentially going this route:

was thinking we could use this.getPlugins in analytics.ts to find the QueueFlushingPlugin, so she could call dequeueEvents and pendingEvents directly from QueueFlushingPlugin without adding new functions in plugin.ts and SegmentDestination.ts

@alanjcharles alanjcharles self-requested a review May 13, 2025 16:09
@alanjcharles alanjcharles dismissed their stale review May 13, 2025 16:13

would like to go a different route that touches less files

@sunitaprajapati89
Copy link
Contributor Author

sunitaprajapati89 commented May 14, 2025

This would definitely work.

@wenxi-zeng mentioned potentially going this route:

was thinking we could use this.getPlugins in analytics.ts to find the QueueFlushingPlugin, so she could call dequeueEvents and pendingEvents directly from QueueFlushingPlugin without adding new functions in plugin.ts and SegmentDestination.ts

QueueFlushingPlugin.ts is an UtilityPlugin which is not directly used in analytics.ts. Destinations Plugins (SegentDestination.ts) is using QueueFlusingPlugin.ts to queue/flush events. I think we won't be able to access QueueFlushingPlugin methods directly from analytics.ts until it is been added explicitly as plugin. But SegmentDestination is auto added as plugin to SegmentClient so access to queueflushingPlugin is possible via SegentDestination.ts.

@wenxi-zeng
Copy link
Contributor

This would definitely work.
@wenxi-zeng mentioned potentially going this route:

was thinking we could use this.getPlugins in analytics.ts to find the QueueFlushingPlugin, so she could call dequeueEvents and pendingEvents directly from QueueFlushingPlugin without adding new functions in plugin.ts and SegmentDestination.ts

QueueFlushingPlugin.ts is an UtilityPlugin which is not directly used in analytics.ts. Destinations Plugins (SegentDestination.ts) is using QueueFlusingPlugin.ts to queue/flush events. I think we won't be able to access QueueFlushingPlugin methods directly from analytics.ts until it is been added explicitly as plugin. But SegmentDestination is auto added as plugin to SegmentClient so access to queueflushingPlugin is possible via SegentDestination.ts.

you can use this.getPlugins to find SegmentDestination and then find QueueFlushingPlugin in SegmentDestination's timeline

@sunitaprajapati89 sunitaprajapati89 merged commit 75f0cba into master May 16, 2025
5 checks passed
@sunitaprajapati89 sunitaprajapati89 deleted the enhancement_clear_queue_flush branch May 16, 2025 05:35
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.

4 participants