ndb/txn: inherit active transactions on the same thread
Many different parts of the codebase could be opening transactions when somewhere higher in the heirarchy on the main thread might already have an active transaction. This can lead to failed transaction opening which is bad. Instead of relying on passing down the transaction to subviews, lets keep track of the active transactions in a thread-local dictionary. That way whenever we create a new transaction we can inherit the one that is already active in the current thread. Inherited transactions don't end the query when they are garbage collected, we still expect the first-opened query to do this.
This commit is contained in:
@@ -41,7 +41,7 @@ enum NdbData {
|
||||
|
||||
class NdbNote: Encodable, Equatable, Hashable {
|
||||
// we can have owned notes, but we can also have lmdb virtual-memory mapped notes so its optional
|
||||
private let owned: Bool
|
||||
let owned: Bool
|
||||
let count: Int
|
||||
let key: NoteKey?
|
||||
let note: UnsafeMutablePointer<ndb_note>
|
||||
|
||||
Reference in New Issue
Block a user