snowplow / snowplow-ios-tracker

Snowplow event tracker for Swift and Objective-C. Add analytics to your iOS, macOS, tvOS and watchOS apps and games
http://snowplow.io
Apache License 2.0
81 stars 93 forks source link

Add configurable limit for the maximum age and number of events in the event store and remove old events before sending (close #860) #861

Closed matus-tomlein closed 9 months ago

matus-tomlein commented 10 months ago

Issue #860

The event store is currently unbounded meaning that if events fail to be sent to the collector, they are never removed from the event store. This can lead to it growing endlessly (if for instance an ad blocker blocks the collector domain) which is likely to have an impact on the app.

We should add configurable limits to the event store so that old events are removed. We could have two such limits:

The implementation in this PR adds these limits and enforces them before each emit attempt. They are enforced by running a single SQL statement which should be relatively efficient.