apple / apple/sample-cloudkit-sync-engine
Implementation flaw
- Langage dominant
- Swift
- Étoiles
- 270
- Forks
- 15
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Hi there,
I think there is an implementation error in the sample project - more specifically, a flaw in the design of CKSyncEngine.
In the SyncedDatabase file, line 350:
self.syncEngine.state.add(pendingRecordZoneChanges: pendingSaves)
This tells the syncEngine what to do when the time is right. Since this piece of information is *not* persisted in this call (I think its persisted in .stateUpdate(let event)), there is a chance that this information is lost if the app crashes between .add(pendingRecordZoneChanges: pendingSaves) and .stateUpdate(let event).
I know this is just a sample project, but I really think this is a flaw in the API design of CKSyncEngine since I do not see an easy way to guarantee correct behavior. A simple fix would be to make .add(pendingRecordZoneChanges: pendingSaves) (and similar methods) async and only complete after .stateUpdate(let event) was called.
What do you think?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans SyncedDatabase à la ligne 350 et examinez la manière dont pendingRecordZoneChanges et l’événement stateUpdate sont gérés. Évaluez la fenêtre de crash décrite dans l’issue et la modification asynchrone proposée de l’API ; le travail est terminé lorsqu’une résolution confirmée par un maintainer existe pour le problème de perte de données ou de conception de l’API.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- swift
- Domaine
- cloud, databases
- Type d'issue
- Bug
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100