apple / apple/sample-cloudkit-sync-engine

Implementation flaw

Đang mở
#5 14 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Swift
Star
270
Fork
15
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu trong SyncedDatabase ở dòng 350 và xem xét cách pendingRecordZoneChanges cùng sự kiện stateUpdate được xử lý. Đánh giá khoảng thời gian có thể xảy ra crash được mô tả trong issue và thay đổi API bất đồng bộ được đề xuất; công việc được coi là hoàn tất khi có giải pháp được maintainer xác nhận cho mối lo ngại về mất dữ liệu hoặc thiết kế API.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
swift
Lĩnh vực
cloud, databases
Loại issue
Lỗi
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.