apple / apple/sample-cloudkit-sync-engine
Implementation flaw
- 主要语言
- Swift
- 星标
- 270
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 SyncedDatabase 的第 350 行开始,检查 pendingRecordZoneChanges 和 stateUpdate 事件的处理方式。评估 issue 中描述的崩溃窗口以及提议的异步 API 更改;只有在 maintainer 确认已解决数据丢失或 API 设计方面的问题后,才算完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- swift
- 领域
- cloud, databases
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100