This is a little bit of a fork of Bug 1189170. The current SwiftData withConnection and transaction calls, and their wrappers in BrowserDB, are the worst kind of async -- they block two threads at once! We call dispatch_sync to hand a block over to the connection's queue. That means we wait for the current queue contents to finish running, run the block, and then finally return from the caller. And very often what we do after that is return a Deferred or invoke some UI callback. In those cases, there's really no reason to use dispatch_sync; we can have the callback do the right thing, such as filling the Deferred. The calling code can roll right on and do what it likes, chaining off the Deferred if it needs the result.
Created attachment 8689781 [details] [review] Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1284
Comment on attachment 8689781 [details] [review] Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1284 Makes sense, though I noticed you aren't actually using synchronous = false anywhere. Just groundwork for bug 1189170?
Attachment #8689781 - Flags: review?(bnicholson) → review+
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0
You need to log in before you can comment on or make changes to this bug.