apple / apple/sample-cloudkit-sync-engine
Implementation flaw
- Lenguaje dominante
- Swift
- Estrellas
- 270
- Forks
- 15
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza en SyncedDatabase, en la línea 350, y revisa cómo se gestionan pendingRecordZoneChanges y el evento stateUpdate. Evalúa la ventana de crash descrita en el issue y el cambio propuesto a la API asíncrona; el trabajo se considera terminado cuando exista una resolución confirmada por un maintainer para el problema de pérdida de datos o de diseño de la API.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- swift
- Área
- cloud, databases
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100