Further improvements to app lifecycle handling
- Resend subscription requests to relays when websocket connection is re-established - More safeguard checks on whether Ndb is opened before accessing its memory - Cancel queued unsubscribe requests on app backgrounding to avoid race conditions with subscribe requests when app enters the foreground - Call Ndb re-open when Damus is active (not only on active notify), as experimentally there have been instances where active notify code has not been run. The operation is idempotent, so there should be no risk of it being called twice. Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -701,9 +701,10 @@ class Ndb {
|
||||
terminationStarted = true
|
||||
Log.debug("ndb_wait: stream: Terminated early", for: .ndb)
|
||||
streaming = false
|
||||
ndb_unsubscribe(self.ndb.ndb, subid)
|
||||
Task { await self.unsetCallback(subscriptionId: subid) }
|
||||
filtersPointer.deallocate()
|
||||
guard !self.is_closed else { return } // Double-check Ndb is open before sending unsubscribe
|
||||
ndb_unsubscribe(self.ndb.ndb, subid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user