Revert "nostrdb: close database when backgrounded"

This reverts commit da2bdad18d.

This commit was reverted because it was causing crashes (Occasional `EXC_BAD_ACCESS` errors when accessing database transactions), and because the push notification extension uses Ndb in a read-only manner, which means we no longer need these changes

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2023-12-22 21:25:02 +00:00
committed by William Casarin
parent 6e0af0ba10
commit 26bd50c948
3 changed files with 8 additions and 67 deletions

View File

@@ -29,14 +29,7 @@ class NdbTxn<T> {
self.inherited = true
} else {
self.txn = ndb_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
}
let _ = ndb_begin_query(ndb.ndb.ndb, &self.txn)
Thread.current.threadDictionary["ndb_txn"] = self.txn
self.inherited = false
}