Skip to content
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

Defer saving to persistence store until sync is completed #78

Merged
merged 3 commits into from
Jul 25, 2019

Conversation

manmal
Copy link
Contributor

@manmal manmal commented Jul 4, 2019

In SynchronizationManager, a call to save() in update(with:) entailed that non-optional relationships that were synced across multiple pages were not resolved when CoreData validated the relationship after processing each page, which resulted in an unrecoverable error. The solution proposed in this PR is to defer calling save() until the sync has no more pages to process. Thus, the relationship validation is performed only after the last page has been processed.

To ensure that the deferral of calling save() does not negatively affect other use cases, asserts have been added to most complex sync tests that ensure that the synced records have been written to storage (hasChanges == false).

Assert in all complex sync tests that the records/assets have
actually been stored to the persistence integration, to
ensure that every sync has resulted in a call to
SynchronizationManager.save()
@manmal
Copy link
Contributor Author

manmal commented Jul 4, 2019

This depends on contentful/contentful.swift#277 - we might need to release contentful 5.0.1 and depend on it
Now depends on contentful.swift 5.0.2 and should be good to go

@Khaledgarbaya Khaledgarbaya merged commit f6c23e7 into contentful:master Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants