mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-09 16:32:46 +01:00
Do CloudKit record process loop on a high priority background thread so that it doesn't block the main thread
This commit is contained in:
parent
b77e2164cd
commit
ac9ba39ea2
@ -132,8 +132,12 @@ private extension CloudKitArticlesZoneDelegate {
|
||||
group.leave()
|
||||
}
|
||||
|
||||
let parsedItems = records.compactMap { makeParsedItem($0) }
|
||||
group.enter()
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
let parsedItems = records.compactMap { self.makeParsedItem($0) }
|
||||
let webFeedIDsAndItems = Dictionary(grouping: parsedItems, by: { item in item.feedURL } ).mapValues { Set($0) }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
for (webFeedID, parsedItems) in webFeedIDsAndItems {
|
||||
group.enter()
|
||||
self.account?.update(webFeedID, with: parsedItems, deleteOlder: false) { result in
|
||||
@ -153,6 +157,10 @@ private extension CloudKitArticlesZoneDelegate {
|
||||
}
|
||||
}
|
||||
}
|
||||
group.leave()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
group.notify(queue: DispatchQueue.main) {
|
||||
if errorOccurred {
|
||||
|
Loading…
Reference in New Issue
Block a user