Floating-Dartists / matomo-tracker

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo API.
https://pub.dev/packages/matomo_tracker
MIT License
26 stars 28 forks source link

Feat/keep failed request in queue #52

Closed TesteurManiak closed 1 year ago

TesteurManiak commented 1 year ago

This PR aims to fix #51, basically any request that didn't send successfully will stay in the queue and we only clear it afterwards.

I've also added improved a bit our current logging system and added some exceptions instead of just checking using assertions. (We should also consider at some point to add a verbose property to enable logging or not but that'll be for a future PR)

mattjbrent commented 1 year ago

@TesteurManiak thanks for getting to this so fast!

Just for anyone else who sees this in the future. I believe this lib ticks on _dequeueInterval which is currently set to 10 seconds - which means Matomo will receive requests every 10 seconds if there is anything that is queued up to be sent to Matomo.

This feature will now only remove those events from the queue if they have sent successfully, meaning that events will continue to fail whilst the app does not have internet (or can't reach Matomo), until it reconnects with Matomo and will send all events in a batch request.

@TesteurManiak please correct if any of that is incorrect.

TesteurManiak commented 1 year ago

@mattjbrent you are correct, the events that failed to be sent will stay in the queue until they're sent successfully (or until the app is closed)