benjaminmayo / merchantkit

A modern In-App Purchases management framework for iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about multithreading

bernikovich opened this issue · comments

How does MerchantKit is designed when we talk about Multithreading? From my experience some of the task call completionBlock on main queue, others (restore?) on background. Is it by design or not?

This is definitely one place where I should nail down a formal policy (and document it).

It works like this: MerchantDelegate and ProductInterfaceController methods always fire on the main thread. The queue for the onCompletion of individual tasks is not guaranteed, and should be considered an arbitrary queue, and you should always dispatch async onto the main thread to perform UI updates.

That being said, I'm happy to adjust this policy if people want to standardise differently.

What do you think about adding completionQueue variable to base task class? Anyway, thanks for clarification. :)

Do you think that is better than just letting people DispatchQueue.main.async themselves? Adding a property for an individual task seems superfluous.

It’s just a point to think about. You can close the issue. :)

Thanks for reaching out. As a result, documentation for the threading conditions is on the todo-list.