Don't use a back ground queue for doing dictionary lookups. Fixes #2656
This commit is contained in:
parent
df359db69f
commit
9ee16d3534
|
@ -115,38 +115,35 @@ final class CloudKitArticlesZone: CloudKitZone {
|
||||||
var newRecords = [CKRecord]()
|
var newRecords = [CKRecord]()
|
||||||
var deleteRecordIDs = [CKRecord.ID]()
|
var deleteRecordIDs = [CKRecord.ID]()
|
||||||
|
|
||||||
DispatchQueue.global(qos: .utility).async {
|
for statusUpdate in statusUpdates {
|
||||||
|
switch statusUpdate.record {
|
||||||
for statusUpdate in statusUpdates {
|
case .all:
|
||||||
switch statusUpdate.record {
|
modifyRecords.append(self.makeStatusRecord(statusUpdate))
|
||||||
case .all:
|
modifyRecords.append(self.makeArticleRecord(statusUpdate.article!))
|
||||||
modifyRecords.append(self.makeStatusRecord(statusUpdate))
|
case .new:
|
||||||
modifyRecords.append(self.makeArticleRecord(statusUpdate.article!))
|
newRecords.append(self.makeStatusRecord(statusUpdate))
|
||||||
case .new:
|
newRecords.append(self.makeArticleRecord(statusUpdate.article!))
|
||||||
newRecords.append(self.makeStatusRecord(statusUpdate))
|
case .delete:
|
||||||
newRecords.append(self.makeArticleRecord(statusUpdate.article!))
|
deleteRecordIDs.append(CKRecord.ID(recordName: self.statusID(statusUpdate.articleID), zoneID: Self.zoneID))
|
||||||
case .delete:
|
case .statusOnly:
|
||||||
deleteRecordIDs.append(CKRecord.ID(recordName: self.statusID(statusUpdate.articleID), zoneID: Self.zoneID))
|
modifyRecords.append(self.makeStatusRecord(statusUpdate))
|
||||||
case .statusOnly:
|
deleteRecordIDs.append(CKRecord.ID(recordName: self.articleID(statusUpdate.articleID), zoneID: Self.zoneID))
|
||||||
modifyRecords.append(self.makeStatusRecord(statusUpdate))
|
|
||||||
deleteRecordIDs.append(CKRecord.ID(recordName: self.articleID(statusUpdate.articleID), zoneID: Self.zoneID))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self.modify(recordsToSave: modifyRecords, recordIDsToDelete: deleteRecordIDs) { result in
|
|
||||||
switch result {
|
self.modify(recordsToSave: modifyRecords, recordIDsToDelete: deleteRecordIDs) { result in
|
||||||
case .success:
|
switch result {
|
||||||
self.saveIfNew(newRecords) { result in
|
case .success:
|
||||||
switch result {
|
self.saveIfNew(newRecords) { result in
|
||||||
case .success:
|
switch result {
|
||||||
completion(.success(()))
|
case .success:
|
||||||
case .failure(let error):
|
completion(.success(()))
|
||||||
completion(.failure(error))
|
case .failure(let error):
|
||||||
}
|
completion(.failure(error))
|
||||||
}
|
}
|
||||||
case .failure(let error):
|
|
||||||
self.handleModifyArticlesError(error, statusUpdates: statusUpdates, completion: completion)
|
|
||||||
}
|
}
|
||||||
|
case .failure(let error):
|
||||||
|
self.handleModifyArticlesError(error, statusUpdates: statusUpdates, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue