Weekly Roundup Improvements (Core Data + Localization) #17766
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes some changes to the Core Data usage in the Weekly Roundup background task, to hopefully fix #17765.
The original issue was hard to reproduce, but my guess was that it was due to sometimes accessing the site managed objects on a different queue to the one their context belonged to. I was able to recreate it more consistently (but not every time) by wrapping the
scheduleNotification
andrequestData
BlockOperations
inWeeklyRoundupBackgroundTask
in separateDispatchQueue.async
calls for different queues.I also noticed that even without these changes the Weekly Roundup tester in Me > App Settings > Debug > Weekly Roundup didn't seem to work consistently. Sometimes it would fail entirely, other times I would only see the 'static' notification, and other times I would only see a notification for a single site.
With the changes in this PR, it appears to be working for me every time.
I also took the opportunity to localize the notification strings, as I noticed they weren't localized.
To test
Regression Notes
This should only affect the weekly roundup background task.
N/A
PR submission checklist:
RELEASE-NOTES.txt
if necessary.