commit 054714794dd743fa87d7ab88b5d6380960fcd515
parent 2c4c392b76d9ad92b28e71d6d578bdb42c2ac3de
Author: William Casarin <jb55@jb55.com>
Date: Sun, 16 Oct 2022 11:05:19 -0700
attempt reconnects every 4 seconds instead of 60
Changelog-Fixed: Damus will now stay connected at all times
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/damus/ContentView.swift b/damus/ContentView.swift
@@ -68,7 +68,7 @@ struct ContentView: View {
@StateObject var home: HomeModel = HomeModel()
// connect retry timer
- let timer = Timer.publish(every: 60, on: .main, in: .common).autoconnect()
+ let timer = Timer.publish(every: 4, on: .main, in: .common).autoconnect()
let sub_id = UUID().description
@@ -329,6 +329,7 @@ struct ContentView: View {
}
.onReceive(timer) { n in
self.damus_state?.pool.connect_to_disconnected()
+ update_signal_from_pool(signal: self.home.signal, pool: self.damus_state!.pool)
}
}
diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift
@@ -190,15 +190,6 @@ class HomeModel: ObservableObject {
func handle_event(relay_id: String, conn_event: NostrConnectionEvent) {
switch conn_event {
case .ws_event(let ev):
-
- /*
- if let wsev = ws_nostr_event(relay: relay_id, ev: ev) {
- wsev.flags |= 1
- self.events.insert(wsev, at: 0)
- }
- */
-
-
switch ev {
case .connected:
if !done_init {
@@ -224,8 +215,6 @@ class HomeModel: ObservableObject {
break
}
- update_signal_from_pool(signal: self.signal, pool: self.pool)
-
print("ws_event \(ev)")
case .nostr_event(let ev):
@@ -603,3 +592,4 @@ func remove_bootstrap_nodes(_ damus_state: DamusState) {
}
}
}
+