Prevent deadlocks by notifying group completion on background thread

This commit is contained in:
Maurice Parker 2020-04-29 15:36:28 -05:00
parent d1c3d43018
commit f193b6da1a
1 changed files with 7 additions and 3 deletions

View File

@ -456,11 +456,15 @@ extension CloudKitZone {
}
}
group.notify(queue: DispatchQueue.main) {
group.notify(queue: DispatchQueue.global(qos: .background)) {
if errorOccurred {
completion(.failure(CloudKitZoneError.unknown))
DispatchQueue.main.async {
completion(.failure(CloudKitZoneError.unknown))
}
} else {
completion(.success(()))
DispatchQueue.main.async {
completion(.success(()))
}
}
}