matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

[Question] Why need to execute on main thread? #427

Open ghost opened 1 year ago

ghost commented 1 year ago

Hi there,

I'm reading the latest source code and wondering why it requires running on the main thread. For example:

I'm worrying that there may be a UI glitch while a huge amount of events are queued in a short period.

If the reason for using the main thread is for its serial queue, then can we use a serial background queue instead? The enqueue/dequeue/network functions should be fine running on a background thread, or is there any reason I'm not aware of?

brototyp commented 1 year ago

Hi @nelson-dai-17Live, you are correct, it doesn't have to be the main thread. We could move this al into a single, serial background queue instead.

ghost commented 1 year ago

@brototyp Thanks for your kind reply, may I know if there is any timeline for this enhancement?

brototyp commented 1 year ago

Hi @nelson-dai-17Live, there is not timeline for it now.

I am open for PRs on this any am happy to collaborate.