Closed danigutierrezayuso closed 9 months ago
Hi @danigutierrezayuso, thanks for reporting this! I agree that the current behaviour is quite unexpected and doesn't fit with the buffer configuration options. It is on radar to revisit this, we'll discuss it in the team soon.
I've created a PR with changes to fix this behavior (it doesn't include any tests though): https://github.com/snowplow/snowplow-ios-tracker/pull/833
We've seen that the
bufferOption
on theEmitterConfiguration
is not being used to check if an event should be sent directly or not.When sending a new event the function 'addPayload' from the
Emitter
class is called, and that function is going to save the event in the 'eventStore' (SQLite in our case) and then is going to call theflush()
function directly, so every time a new event is added there will be a new request sending that single event to the server.Maybe on that
addPayload
function we should only call theflush
function when the number of events saved in theeventStore
has reached thebufferOption
value. Doing so I think we can have the behavior described in the documentation:Current behavior After setting the
bufferOption
configuration todefaultGroup
(10 events) the events are being sent one by one.Expected behavior After setting the
bufferOption
configuration todefaultGroup
(10 events) the events are being sent on requests with a payload containing an array of 10 events.