-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix concurrency issue with Blaze local notification scheduler #14012
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
argument = "-com.apple.CoreData.ConcurrencyDebug 1" | ||
isEnabled = "YES"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small nit: I think you left the ConcurrencyDebug
check enabled here 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmusolino I intentionally enabled that as default for now. This would only affect debug build runs. Could you share why we should avoid this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, Huong! Thanks for fixing this.
I tested that Blaze local notifications are scheduled as before. ✅
Closes: #14011
Description
When enabling Core Data concurrency debugging, I got a crash in Blaze local notification scheduler's
scheduleNoCampaignReminder
method.The reason is this method dispatches an async request to check for Blaze eligibility, and then start an observation of the storage for Blaze campaigns. This causes an issue when the observation is done on a background thread.
The fix is to ensure the method is called on the main thread. I moved all the
@MainActor
annotations to the protocol to also support Swift targeted concurrency check.Steps to reproduce
Testing information
Tested on simulator iPad 10th gen iOS 17.4 and confirmed that the app no longer crashes in debug mode on dashboard screen.
Screenshots
N/A
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: