Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudKit extension: Tips on recovering from CKError.LimitExceeded #328

Closed
heiberg opened this issue May 30, 2016 · 2 comments
Closed

CloudKit extension: Tips on recovering from CKError.LimitExceeded #328

heiberg opened this issue May 30, 2016 · 2 comments

Comments

@heiberg
Copy link
Contributor

heiberg commented May 30, 2016

When using YapDatabaseCloudKit, the extension will accumulate changes for upload. A change set can be arbitrarily large and will result in a single CKModifyRecordsOperation.

In some cases, for example during a database maintenance or migration operation, a significant number of objects could be modified. Resulting in a CKModifyRecordsOperation with a lot of records.

I'm seeing these operations fail with CKError.LimitExceeded, resulting in a suspended extension, and I'm currently looking for the best way to recover from this.

Without a way to break the pending change set up into smaller batches for upload, the extension will just encounter the same CKError.LimitExceeded when resumed, and sync will permanently cease to function for that particular installation.

One possible solution could be the introduction of a configurable operation batch size on the CloudKit extension. The application, or the extension itself, could reduce this when a LimitExceeded is encountered. Such a batch size would likely have to be dynamic, as the acceptable CloudKit operation size is not specified. An approach similar to the TCP protocol's exponential backoff could be used to home in on an acceptable operation size.

Is there some way to recover from this situation with the current version of YDBCK?

@SofteqDG
Copy link
Contributor

SofteqDG commented Jun 3, 2016

Read discussion in #212.
I have also added a PR #268 with one possible solution (works fine in my app).

@heiberg
Copy link
Contributor Author

heiberg commented Jun 4, 2016

Thanks, @SofteqDG! Excellent point about preserving CKReference integrity when splitting batches. My data model is very simple, just a pool of separate objects with no references, so your open PR was just what I needed. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants