From 7fc581696b54394cfe3b49577c27c63a376500b4 Mon Sep 17 00:00:00 2001 From: Jakub Olejnik Date: Wed, 28 Apr 2021 12:44:36 +0200 Subject: [PATCH] fixup! Fix threading in `DatabaseContainer` --- Sources/StreamChat/Database/DatabaseContainer.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/StreamChat/Database/DatabaseContainer.swift b/Sources/StreamChat/Database/DatabaseContainer.swift index 9a51ef74416..11dcec94c04 100644 --- a/Sources/StreamChat/Database/DatabaseContainer.swift +++ b/Sources/StreamChat/Database/DatabaseContainer.swift @@ -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 @@ -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 @@ -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 } }