We found a bug where every analytic event was being sent multiple times
The reason why was because our sessionsQueue was never being wiped after events were already sent out in an API request
This PR takes a path-of-least-resistance approach to fixing this duplicate events bug
It uses the existing batch POST formatting, but only sends a single event per API request
Previously we were still sending an API request every time sendAnalyticsEvent() was called, but with this change, the payload won't contain duplicate events
Our batching logic needs a dedicated revamp (handling app backgrounding, memory wipe, etc) - JIRA DTBTSDK-3629 created
Changes
Remove unused flushThreshold & flush logic (this was never called within the SDK)
Remove improperly managed DispatchQueue for holding events. This was never getting cleared, thus sending every event multiple times. We can re-add this when we have more time to properly implement the queue's maintenance and clearance.
Move to async-await style for BTAnalyticsService.sendAnalyticsEvent() method
Summary
sendAnalyticsEvent()
was called, but with this change, the payload won't contain duplicate eventsChanges
flushThreshold
& flush logic (this was never called within the SDK)DispatchQueue
for holding events. This was never getting cleared, thus sending every event multiple times. We can re-add this when we have more time to properly implement the queue's maintenance and clearance.BTAnalyticsService.sendAnalyticsEvent()
methodChecklist
Authors
@scannillo @jaxdesmarais