apple / apple/sample-cloudkit-sync-engine

Implementation flaw

Offen
#5 14 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Swift
Sterne
270
Forks
15
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne in SyncedDatabase bei Zeile 350 und überprüfe, wie pendingRecordZoneChanges und das stateUpdate-Ereignis behandelt werden. Bewerte das im Issue beschriebene Crash-Fenster und die vorgeschlagene asynchrone API-Änderung; abgeschlossen ist die Aufgabe erst, wenn eine von einem Maintainer bestätigte Lösung für das Datenverlust- oder API-Design-Problem vorliegt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
swift
Bereich
cloud, databases
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.