Skip to content

Commit

Permalink
fixup! Fix threading in DatabaseContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
olejnjak committed Apr 28, 2021
1 parent 9c8293e commit 7fc5816
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/StreamChat/Database/DatabaseContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DatabaseContainer: NSPersistentContainer {
let context = newBackgroundContext()
context.automaticallyMergesChangesFromParent = true
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
context.performAndWait { [localCachingSettings] in
context.perform { [localCachingSettings] in
context.localCachingSettings = localCachingSettings
}
return context
Expand All @@ -59,7 +59,7 @@ class DatabaseContainer: NSPersistentContainer {
let context = newBackgroundContext()
context.automaticallyMergesChangesFromParent = true
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
context.performAndWait { [localCachingSettings] in
context.perform { [localCachingSettings] in
context.localCachingSettings = localCachingSettings
}
return context
Expand Down Expand Up @@ -130,7 +130,7 @@ class DatabaseContainer: NSPersistentContainer {
if Thread.current.isMainThread {
viewContext.localCachingSettings = localCachingSettings
} else {
viewContext.performAndWait { [localCachingSettings] in
viewContext.perform { [viewContext, localCachingSettings] in
viewContext.localCachingSettings = localCachingSettings
}
}
Expand Down

0 comments on commit 7fc5816

Please sign in to comment.