optimizely/python-sdk

Asynchronously triggering events

walterqian opened this issue · 2 comments

Currently when calling event_dispatcher it's a blocking call. This network request slows down calls to activate and track, which can add up if we're making a lot of calls. I wonder if it's possible to make it in a task to make the dispatch_event call smoother.

https://github.com/optimizely/python-sdk/blob/master/optimizely/event_dispatcher.py#L34-L40

@walterqian thank you for reaching out regarding this.

We have addressed this and introduced asynchronous event batching and dispatching in our 3.3.0 release (use the latest 3.3.1 release).

Now, calls to activate and track are not blocking. Instead, the event to be dispatched is sent in a separate thread where multiple events (individual calls to activate and track) are batched together and sent in a single payload to Optimizely.

I'd recommend you to try it out and let us know of any feedback.

Ah thank you so much. My bad for not using the latest version.