Closed itsmeichigo closed 2 weeks ago
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
App Name | WooCommerce iOS | |
Build Number | pr12629-470e292 | |
Version | 18.4 | |
Bundle ID | com.automattic.alpha.woocommerce | |
Commit | 470e292c921d0290c1fea60e5a251f2f999ddb30 | |
App Center Build | WooCommerce - Prototype Builds #8922 |
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
Closes: #12536
Description
When syncing stats on the dashboard screen, we track the performance after the syncing completes. These were called immediately inside the
reloadData
methods onStorePerformanceViewModel
andTopPerformersDashboardViewModel
. Both methods are async and marked with@MainActor
for the results to be returned on the main thread.When sending Tracks events, the events are created and saved to CoreData using
performAndWait
. If I understand correctly, this is to make it safe to send events continuously and synchronously. However, this happens on a background thread and blocks the async methods running on the main thread, causing potential UI hang, thus Xcode logs a warning for thread priority inversion.To fix this issue, I created a separate publisher to keep track when syncing stats completes, and observe the data stream in a background thread before sending Tracks events. This makes sure that Tracks doesn't block the async method on the main thread.
Testing instructions
Screenshots
N/A
RELEASE-NOTES.txt
if necessary.