postbox: try flushing events every second
relying on network activity for flushing is not reliable and is causing delays in zapping
This commit is contained in:
@@ -80,6 +80,9 @@ struct ContentView: View {
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
|
||||
// connect retry timer
|
||||
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
||||
|
||||
var mystery: some View {
|
||||
Text("Are you lost?", comment: "Text asking the user if they are lost in the app.")
|
||||
.id("what")
|
||||
@@ -347,6 +350,9 @@ struct ContentView: View {
|
||||
let action = notif.object as! PostAction
|
||||
self.active_sheet = .post(action)
|
||||
}
|
||||
.onReceive(timer) { n in
|
||||
self.damus_state?.postbox.try_flushing_events()
|
||||
}
|
||||
.onReceive(handle_notify(.deleted_account)) { notif in
|
||||
self.is_deleted_account = true
|
||||
}
|
||||
|
||||
@@ -93,8 +93,6 @@ class PostBox {
|
||||
}
|
||||
|
||||
func handle_event(relay_id: String, _ ev: NostrConnectionEvent) {
|
||||
try_flushing_events()
|
||||
|
||||
guard case .nostr_event(let resp) = ev else {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user