Robust CoreData-CloudKit synchronization: offline editing, relationships, private, shared and public databases, field-level deltas, encrypted values, cacheable assets, and more.
MIT License
157
stars
17
forks
source link
Add semaphore to limit one change being processed at once #16
When we create multiple objects in quick succession there is a race condition where the same records are added to by synced multiple times, this causes a CKError and stops the rest of the batch from completing.
Adding a semaphore here ensures that only one of the processChanges() blocks in run at once and therefore ensures that records are converted, processed and removed from history all before running again ensuring no duplicates.
When we create multiple objects in quick succession there is a race condition where the same records are added to by synced multiple times, this causes a CKError and stops the rest of the batch from completing.
Adding a semaphore here ensures that only one of the
processChanges()
blocks in run at once and therefore ensures that records are converted, processed and removed from history all before running again ensuring no duplicates.