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

Limitation for number of changes per one change request in CloudKit extension #268

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SofteqDG
Copy link
Contributor

Ability to set the limit for number of changes per one change request in YapDatabaseCloudKitOptions. This can be used to fix "Invalid Arguments" (12/1020); "Your request contains more than the maximum number of items in a single request (400)" error. Discussion in #212.

@triplef
Copy link

triplef commented Jul 22, 2019

We were running into the same issue and have been using this patch for several years in production. Would be great to get this merged. 👍

@gcox
Copy link
Contributor

gcox commented Sep 20, 2019

@robbiehanson Can you weigh in on this, please? Maybe I'm misunderstanding #212, but it sounds like if this issue is encountered when registering the extension there is no way around the problem and CloudKit syncing is effectively broken without a change like the one in this PR. Is that correct?

@robbiehanson
Copy link
Contributor

The "max of 400" problem can be encountered in multiple scenarios:

  • when registering the extension, and populating it with a large number of items
  • when importing a large number of items within a single transaction

This PR limits the maximum number of changes that can be pushed to the cloud in a single request. This would seem to solve the issue. However, I haven't merged this pull request because, as I understand it, the PR does its limitation in an "arbitrary" manner. Whereby "arbitrary", I mean that it doesn't take into account CKReferences.

I suggested in #212 :

Fix the internals of YapDatabaseCloudKit to automatically split a ChangeSet into a maximum of 400 items. And do so in a safe way that allows us to take into consideration CKReferences.

So if A has a CKReference to B, and the ChangeSet is split like so: [..., A] [B, ...], we're going to get an error from the server. Its been awhile since I've worked with CloudKit, so let me know if I'm off on this.

@gcox
Copy link
Contributor

gcox commented Oct 1, 2019

@robbiehanson Thanks for your input. Your description is correct. I have an idea for addressing that problem so I'll look into it soon.

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

Successfully merging this pull request may close these issues.

4 participants