Closed sjavora closed 3 years ago
Yup, that makes sense. The SDK had issues with thread safety so switching to background thread seemed a bit crazy, but those issues were fixed a couple of versions back and this slipped. I'll add it to our backlog, with current state it should be an easy fix.
Thanks for the report!
Just released version 2.8.0 where DatabaseManager
uses background context.
This should be resolved, thanks again for reporting!
Just noticed this when profiling our app - DatabaseManager.swift uses the context property for interacting with Core Data. This is defined as
persistentContainer.viewContext
. This means thatcontext
is associated with the main queue as described in the docs. All operations inDatabaseManager
begin withcontext.performAndWait
-perform
andperformAndWait
run the block on the queue that the context is associated with... in this case, the main queue.Since
performAndWait
is run synchronously on the context's queue, the main queue is blocked whileDatabaseManager
methods are run. This results in our app freezing when the database manager decides to do something.As far as I know, there is nothing the app can do about this. Please let me know if my analysis is wrong, but I can't find anything else in the time profiler to explain this.