-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for synchronously flush #74
Comments
hey @jn011, that is correct. analytics-csharp does not block and wait for flush to be completed. it is designed to work in a fire-and-forget manner to achieve higher throughputs. by explicitly calling you can always write your own plugin to make uploads synchronous, but it's not an easy job and strongly discouraged since it will degrade the performance of your app. could you please provide more context about your use case of needing a sync flush? I can file a feature request if it feels necessary. thanks! |
Hey @wenxi-zeng interesting, thanks for sharing. For my use case I want flush to be synchronous for processing and emptying an events in the queue. All events should still be queued asynchronously ideally. This is how my flow looks:
Any ideas/thoughts are welcome |
hey @jn011, thanks for the additional detail. this is a valid use case. probably very common for server use cases. so we will add support to it. |
Thanks @wenxi-zeng Please let me know when this is done. It's the missing piece in order of us to migrate to the new API. Have you got an extensive list of what's improved from Analytics.NET anywhere? |
@jn011 we don't have a list yet. but performance-wise, you can take a look at this blog that we benchmarked the old and new android/ios sdks. we do have a plan to write another blog for this c# library. analytics-csharp implements the same architecture as all of the Segment next-gen libraries (kotlin/swift/RN2.0/flutter). in addition, it implements a better event pipeline design that improves the throughputs and scalability, makes queueing and flushing events more streamlined and less prone to concurrency issues. feature-wise:
|
Closed in error, this is still in progress. Sorry! |
Hi @wenxi-zeng Any updates on this? |
Hi @jn011 we are working into this! |
Thanks, any further news? @edsonjab |
There's a new release that should address this issue. There is now an option to specify an EventPipelineProvider on the Analytics configuration object. Setting it with a new SyncEventPipeline will use a synchronous flush method. Sorry for the delay in getting this out, we had a couple false starts and distractions. Let us know how it works for you! |
Hi there,
I have recently tried to integrate with the new library in my serverless function which runs on .NET 6.
In Analytics.NET a call to
Flush()
would block the current thread and upload all events in the queue for a given client to Segment.In Analytics-CSharp it seems that flush does not force upload events to segment?
Please checkout my reproduction code below and let me know if my usage is incorrect, in the old client this exact flow works perfectly. For this reason I have continued using Analytics .NET in my project for now.
Thanks!
The text was updated successfully, but these errors were encountered: