-
Notifications
You must be signed in to change notification settings - Fork 364
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
the safeCopy method of CKRecord (YapDatabaseCloudKit) is slow and will casue UI freeze when handlePartialFailure called. #246
Comments
I believe I've addressed the performance problems via the above referenced commits. Please give them a try and let me know.
That's a lot of change sets in the queue. Is this normal? Is there perhaps a problem that's preventing changeSets from getting to the server? Your screenshot shows that [CloutKitManager _refetchMissedRecordIDs] is being invoked. This may be a problem. From the code: if ([failedChangeSet.uuid isEqualToString:lastChangeSetUUID] && self.lastSuccessfulFetchResultWasNoData)
{
// We screwed up a merge somehow.
//
// Here's what happend:
// - We fetched all the record changes (via CKFetchRecordChangesOperation).
// - But we failed to merge the fetched changes into our local CKRecord(s).
// This could be a bug in YapDatabaseCloudKit.
// Or maybe a bug in your CKFetchRecordChangesOperation.fetchRecordChangesCompletionBlock implementation.
// - So at this point we'd normally fall into an infinite loop:
// - We do a CKFetchRecordChangesOperation
// - Find there's no new data (since prevServerChangeToken)
// - Attempt to upload our modified CKRecord(s)
// - Get a partial failure
// - We do a CKFetchRecordChangesOperation
// - ... infinte loop
//
// This is a common problem you might run into during the normal development cycle.
// So we print out a warning here to let you know about the problem.
//
// And then we refetch the missed records.
// Hopefully refetching & re-merging should solve the infinite loop problem.
self.needsRefetchMissedRecordIDs = YES;
[self _refetchMissedRecordIDs];
} Is there a chance your code is in an infinite loop, and continually:
|
Thank you for your update. |
As shown in screen shot,
changeSetsFromPreviousCommits
method is called to get the first change set (i.e. last failed change set), but all the CKRecords in the change set queue will be safe copied.In my case, there are 50 records in every change set and 130 change sets in queue waiting to upload, and unfortunately some records in upload queue is already exists in cloud server while client think it is up to date, that will lead to handlePartialFailure be called.
I can try to dispatch the handle code to background thread to avoid UI freeze but it will still consume cpu time and drain battery.
The text was updated successfully, but these errors were encountered: