Load the current Core Data model once per process#25728
Open
crazytonyli wants to merge 2 commits into
Open
Conversation
Each ContextManager instance used to load its own NSManagedObjectModel from WordPress.momd. Every loaded model registers its entities in Core Data's process-global class-to-entity table, so in unit tests (where each test creates a ContextManager) identical models accumulated and +entity could not disambiguate them. The current model is now cached in a static and shared by all instances, while versioned models for migrations still load per request.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32964 | |
| Version | PR #25728 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 39736ba | |
| Installation URL | 7t10fhrbh9etg |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32964 | |
| Version | PR #25728 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 39736ba | |
| Installation URL | 16inn96gct120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


We have a long-running issue of the Core Data model being created multiple times for each
ContextManager.forTestinginstance, which sometimes causes unit test flakiness. This PR fixes that issue by holding the current model in a static property.The changes should not have any impact on the app, which uses ContextManager singleton.