{"action":"created","issue":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/366","repository_url":"https://api.github.com/repos/danthorpe/Operations","labels_url":"https://api.github.com/repos/danthorpe/Operations/issues/366/labels{/name}","comments_url":"https://api.github.com/repos/danthorpe/Operations/issues/366/comments","events_url":"https://api.github.com/repos/danthorpe/Operations/issues/366/events","html_url":"https://github.com/danthorpe/Operations/issues/366","id":165796918,"number":366,"title":"CloudKitOperation not handling moreComing flag","user":{"login":"leotumwattana","id":544211,"avatar_url":"https://avatars.githubusercontent.com/u/544211?v=3","gravatar_id":"","url":"https://api.github.com/users/leotumwattana","html_url":"https://github.com/leotumwattana","followers_url":"https://api.github.com/users/leotumwattana/followers","following_url":"https://api.github.com/users/leotumwattana/following{/other_user}","gists_url":"https://api.github.com/users/leotumwattana/gists{/gist_id}","starred_url":"https://api.github.com/users/leotumwattana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leotumwattana/subscriptions","organizations_url":"https://api.github.com/users/leotumwattana/orgs","repos_url":"https://api.github.com/users/leotumwattana/repos","events_url":"https://api.github.com/users/leotumwattana/events{/privacy}","received_events_url":"https://api.github.com/users/leotumwattana/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-15T14:18:32Z","updated_at":"2016-07-31T18:56:05Z","closed_at":null,"body":"## Issue\r\nAs per our initial conversation on Slack. It seems CloudKitOperation is not handling the `moreComing` flag. At least for `Operation v3.0`. I haven't checked earlier versions of the library.\r\n\r\n## Investigation\r\nAfter some initial digging under the hood, I'm guessing `moreComing` is suppose to be handled by `BatchedCloudKitOperation<...>`? Please correct me if I'm wrong. So the magic is coming from `willFinishOperation`? \r\n\r\n```\r\npublic override func willFinishOperation(operation: NSOperation) {\r\n        if let cloudKitOperation = operation as? CloudKitOperation<T> {\r\n            generator.more = enableBatchProcessing && cloudKitOperation.current.moreComing\r\n        }\r\n        super.willFinishOperation(operation)\r\n}\r\n```\r\n\r\nI placed a `break point` and found the willFinishOperation was not called. Further digging shows that BatchedCloudKitOperation is defined in the library, but doesn't seem to be part of any **subclassing** nor does it seem to be **used** anywhere. So I'm guessing this may be the issue?"},"comment":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/comments/236449684","html_url":"https://github.com/danthorpe/Operations/issues/366#issuecomment-236449684","issue_url":"https://api.github.com/repos/danthorpe/Operations/issues/366","id":236449684,"user":{"login":"leotumwattana","id":544211,"avatar_url":"https://avatars.githubusercontent.com/u/544211?v=3","gravatar_id":"","url":"https://api.github.com/users/leotumwattana","html_url":"https://github.com/leotumwattana","followers_url":"https://api.github.com/users/leotumwattana/followers","following_url":"https://api.github.com/users/leotumwattana/following{/other_user}","gists_url":"https://api.github.com/users/leotumwattana/gists{/gist_id}","starred_url":"https://api.github.com/users/leotumwattana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leotumwattana/subscriptions","organizations_url":"https://api.github.com/users/leotumwattana/orgs","repos_url":"https://api.github.com/users/leotumwattana/repos","events_url":"https://api.github.com/users/leotumwattana/events{/privacy}","received_events_url":"https://api.github.com/users/leotumwattana/received_events","type":"User","site_admin":false},"created_at":"2016-07-31T18:56:05Z","updated_at":"2016-07-31T18:56:05Z","body":"Sure thing. This is the verbose log from my sample application. What I did is create **500** records and push them up to CloudKit. Then try to fetch them. As you can see towards the end of the log. The fetch operation only manages to get one batch and then `finishes with no errors`, but the `moreComing` flag is `true`.\r\n\r\n### Verbose log\r\n```\r\nZoneSetupOperation: Initialized -> Pending\r\nZoneSetupOperation: Pending -> Executing\r\nCreateRecordOperation: Initialized -> Pending\r\nZoneSetupOperation: Will Execute\r\nCKFetchRecordChangesOperation: Initialized -> Pending\r\nCreateZoneOperation: Initialized -> Pending\r\nCreateZoneOperation: Pending -> Executing\r\nCreateZoneOperation: Will Execute\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Initialized -> Pending\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Pending -> Executing\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Will Execute\r\nZone Setup Operation: Optional([<CKRecordZone: 0x7fa63bd2c5f0; zoneID=CustomPrivateZone:__defaultOwner__, capabilities=(Atomic,Sync)>]) Optional([])\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Executing -> Finishing\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Will finish with no errors.\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Finishing -> Finished\r\nOPRCKOperation<CKModifyRecordZonesOperation>: Did finish with errors: []\r\nCreateZoneOperation: Executing -> Finishing\r\nCreateZoneOperation: Will finish with no errors.\r\nCreateZoneOperation: Finishing -> Finished\r\nCreateZoneOperation: Did finish with errors: []\r\nZoneSetupOperation: Executing -> Finishing\r\nZoneSetupOperation: Will finish with no errors.\r\nZoneSetupOperation: Finishing -> Finished\r\nZoneSetupOperation: Did finish with errors: []\r\nCreateRecordOperation: Pending -> Executing\r\nCreateRecordOperation: Will Execute\r\nCreateRecordCloudKitOperation: Initialized -> Pending\r\nCreateRecordCloudKitOperation: Pending -> Executing\r\nCreateRecordCloudKitOperation: Will Execute\r\nOPRCKOperation<CKModifyRecordsOperation>: Initialized -> Pending\r\nOPRCKOperation<CKModifyRecordsOperation>: Pending -> Executing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will Execute\r\nOPRCKOperation<CKModifyRecordsOperation>: Executing -> Finishing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will finish with 1 errors.\r\nCreateRecordCloudKitOperation: Received CloudKit Limit Exceeded error: ModifyRecordsError<CKRecord, CKRecordID>(underlyingError: <CKError 0x7fa63bdbb5a0: \"Limit Exceeded\" (27/1020); \"Your request contains 500 items which is more than the maximum number of items in a single request (400)\">, saved: Optional([]), deleted: Optional([]))\r\nCloudKitOperation<CKModifyRecordsOperation>: Initialized -> Pending\r\nCloudKitOperation<CKModifyRecordsOperation>: Pending -> Executing\r\nCreateRecordCloudKitOperation: will add next operation: <_TtGC10Operations14OPRCKOperationCSo24CKModifyRecordsOperation_: 0x7fa63be00130>{name = 'OPRCKOperation<CKModifyRecordsOperation>'}\r\nCloudKitOperation<CKModifyRecordsOperation>: Will Execute\r\nCreateRecordCloudKitOperation: did replace configure block.\r\nOPRCKOperation<CKModifyRecordsOperation>: Initialized -> Pending\r\nOPRCKOperation<CKModifyRecordsOperation>: Pending -> Executing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will Execute\r\nDelay for 0.273893074988946 seconds: Initialized -> Pending\r\nOPRCKOperation<CKModifyRecordsOperation>: Initialized -> Pending\r\nDelay for 0.273893074988946 seconds: Pending -> Executing\r\nDelay for 0.273893074988946 seconds: Will Execute\r\nCreateRecordCloudKitOperation: will attempt 2 recovery from errors: [Operations.ModifyRecordsError<CKRecord, CKRecordID>(underlyingError: <CKError 0x7fa63bdbb5a0: \"Limit Exceeded\" (27/1020); \"Your request contains 500 items which is more than the maximum number of items in a single request (400)\">, saved: Optional([]), deleted: Optional([]))] in operation: <_TtGC10Operations14OPRCKOperationCSo24CKModifyRecordsOperation_: 0x7fa63bdaef10>{name = 'OPRCKOperation<CKModifyRecordsOperation>'}\r\nOPRCKOperation<CKModifyRecordsOperation>: Finishing -> Finished\r\nOPRCKOperation<CKModifyRecordsOperation>: Did finish with no errors\r\nDelay for 0.273893074988946 seconds: Executing -> Finishing\r\nDelay for 0.273893074988946 seconds: Will finish with no errors.\r\nDelay for 0.273893074988946 seconds: Finishing -> Finished\r\nDelay for 0.273893074988946 seconds: Did finish with errors: []\r\nOPRCKOperation<CKModifyRecordsOperation>: Executing -> Finishing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will finish with no errors.\r\nOPRCKOperation<CKModifyRecordsOperation>: Finishing -> Finished\r\nOPRCKOperation<CKModifyRecordsOperation>: Did finish with errors: []\r\nCloudKitOperation<CKModifyRecordsOperation>: Executing -> Finishing\r\nCloudKitOperation<CKModifyRecordsOperation>: Will finish with no errors.\r\nCloudKitOperation<CKModifyRecordsOperation>: Finishing -> Finished\r\nCloudKitOperation<CKModifyRecordsOperation>: Did finish with errors: []\r\nOPRCKOperation<CKModifyRecordsOperation>: Pending -> Executing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will Execute\r\nOPRCKOperation<CKModifyRecordsOperation>: Executing -> Finishing\r\nOPRCKOperation<CKModifyRecordsOperation>: Will finish with no errors.\r\nCreateRecordCloudKitOperation: successfully recovered from errors in <_TtGC10Operations14OPRCKOperationCSo24CKModifyRecordsOperation_: 0x7fa63bdaef10>{name = 'OPRCKOperation<CKModifyRecordsOperation>'}\r\nOPRCKOperation<CKModifyRecordsOperation>: Finishing -> Finished\r\nOPRCKOperation<CKModifyRecordsOperation>: Did finish with errors: []\r\nCreateRecordCloudKitOperation: Executing -> Finishing\r\nCreateRecordCloudKitOperation: Will finish with no errors.\r\nCreateRecordCloudKitOperation: Finishing -> Finished\r\nCreateRecordCloudKitOperation: Did finish with errors: []\r\nCreateRecordOperation: Executing -> Finishing\r\nCreateRecordOperation: Will finish with no errors.\r\nCreateRecordOperation: Finishing -> Finished\r\nCreateRecordOperation: Did finish with errors: []\r\nCKFetchRecordChangesOperation: Pending -> Executing\r\nCKFetchRecordChangesOperation: Will Execute\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Initialized -> Pending\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Pending -> Executing\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Will Execute\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Initialized -> Pending\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Pending -> Executing\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Will Execute\r\nServerCT: Optional(<CKServerChangeToken: 0x7fa63bc35aa0; data=AQAAAAAAAADKf/////////+xdqQhv+FCa7uejyX4/tSP>) ClientCT: nil\r\nMore records coming: true\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Executing -> Finishing\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Will finish with no errors.\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Finishing -> Finished\r\nOPRCKOperation<CKFetchRecordChangesOperation>: Did finish with errors: []\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Executing -> Finishing\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Will finish with no errors.\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Finishing -> Finished\r\nCloudKitOperation<CKFetchRecordChangesOperation>: Did finish with errors: []\r\nCKFetchRecordChangesOperation: Executing -> Finishing\r\nCKFetchRecordChangesOperation: Will finish with no errors.\r\nCKFetchRecordChangesOperation: Finishing -> Finished\r\nCKFetchRecordChangesOperation: Did finish with errors: []\r\n```"}}
{"actor":{"display_login":"leotumwattana"}}