debug: add some transaction debugging

This commit is contained in:
William Casarin
2024-01-26 10:50:58 -08:00
parent 010d71d9ed
commit 6e0ba3206d
4 changed files with 16 additions and 8 deletions

View File

@@ -462,23 +462,27 @@ struct ContentView: View {
damus_state.pool.disconnect()
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { obj in
print("📙 DAMUS ACTIVE NOTIFY")
try? damus_state.ndb.reopen()
print("txn: 📙 DAMUS ACTIVE NOTIFY")
if damus_state.ndb.reopen() {
print("txn: NOSTRDB REOPENED")
} else {
print("txn: NOSTRDB FAILED TO REOPEN closed:\(damus_state.ndb.closed)")
}
}
.onChange(of: scenePhase) { (phase: ScenePhase) in
guard let damus_state else { return }
switch phase {
case .background:
print("📙 DAMUS BACKGROUNDED")
print("txn: 📙 DAMUS BACKGROUNDED")
Task { @MainActor in
damus_state.ndb.close()
}
break
case .inactive:
print("📙 DAMUS INACTIVE")
print("txn: 📙 DAMUS INACTIVE")
break
case .active:
print("📙 DAMUS ACTIVE")
print("txn: 📙 DAMUS ACTIVE")
damus_state.pool.ping()
@unknown default:
break