Modify NostrNetworkManager pipeline architecture
Previously, we combined the ndb and network stream within a "session subscription" stream, which was teared down and rebuilt every time the app went into the background and back to the foreground (This was done to prevent crashes related to access to Ndb memory when Ndb is closed). However, this caused complications and instability on the network stream, leading to timeline staleness. To address this, the pipeline was modified to merge the ndb and network streams further upstream, on the multi-session stage, allowing the session subscription streams to be completely split between Ndb and the network. For the ndb stream, we still tear it down and bring it up along the app foreground state, to prevent memory crashes. However, the network stream is kept intact between sessions, since RelayPool will now automatically handle resubscription on websocket reconnection. This prevents complexity and potential race conditions that could lead to timeline staleness. Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -444,6 +444,7 @@ class RelayPool {
|
||||
continue
|
||||
}
|
||||
|
||||
Log.debug("%s: Sending resubscribe request to %s", for: .networking, handler.sub_id, relayId.absoluteString)
|
||||
send(.subscribe(.init(filters: filters, sub_id: handler.sub_id)), to: [relayId], skip_ephemeral: shouldSkipEphemeralRelays)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user