nostrdb: close database when backgrounded
Otherwise iOS gets mad because we are holding onto a lockfile in a
shared container which is apparently not allowed.
Fixes: a1e6be214e ("Migrate NostrDB files to shared app group file container")
This commit is contained in:
@@ -29,7 +29,14 @@ class NdbTxn<T> {
|
||||
self.inherited = true
|
||||
} else {
|
||||
self.txn = ndb_txn()
|
||||
let _ = ndb_begin_query(ndb.ndb.ndb, &self.txn)
|
||||
let ok = ndb_begin_query(ndb.ndb.ndb, &self.txn) != 0
|
||||
if !ok {
|
||||
self.moved = false
|
||||
self.txn = ndb_txn()
|
||||
self.inherited = true
|
||||
self.val = with(self)
|
||||
return
|
||||
}
|
||||
Thread.current.threadDictionary["ndb_txn"] = self.txn
|
||||
self.inherited = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user