apple/sample-cloudkit-privatedb-sync

Should local cache be saved first then save server change token?

Closed this issue · 1 comments

/// Save our new change token representing this point in time.
saveChangeToken(changes.changeToken)
/// Write updated local cache to disk.
await saveLocalCache()

Hi there, I noticed this sample app saves the server change token before local cache were being saved.
Doesn't this mean if the app exits before local cache saved to the UserDefaults, the app will only fetch changes from the newest token the next time it starts and ignoring all previous changes?

Good call — this has been fixed in fbd7254. Thanks!