matomo-sdk-ios icon indicating copy to clipboard operation
matomo-sdk-ios copied to clipboard

[Question] Why need to execute on main thread?

Open ghost opened this issue 1 year ago • 3 comments

Hi there,

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

  • MatomoTracker's func queue(event: Event) and func dispatchBatch()
  • MemoryQueue's functions

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?

ghost avatar Mar 16 '23 03:03 ghost

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.

brototyp avatar Mar 21 '23 14:03 brototyp

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

ghost avatar Mar 22 '23 01:03 ghost

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

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

brototyp avatar Mar 27 '23 18:03 brototyp