threads: check for new notes locally when thread is re-opened
We have a NoteRef cache for threads in memory, which is just a list of NoteKeys and timestamps. When reopening a thread, query the local DB to see if there are any new notes that we might have missed because we weren't actively subscribed to them. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
11
src/app.rs
11
src/app.rs
@@ -887,9 +887,14 @@ fn thread_unsubscribe(app: &mut Damus, id: &[u8; 32]) {
|
||||
|
||||
debug!("thread unsubbing from root_id {}", hex::encode(root_id));
|
||||
|
||||
app.threads
|
||||
.thread_mut(&app.ndb, &txn, root_id)
|
||||
.decrement_sub()
|
||||
let thread = app.threads.thread_mut(&app.ndb, &txn, root_id).get_ptr();
|
||||
let unsub = thread.decrement_sub();
|
||||
|
||||
if let Ok(DecrementResult::LastSubscriber(_subid)) = unsub {
|
||||
*thread.subscription_mut() = None;
|
||||
}
|
||||
|
||||
unsub
|
||||
};
|
||||
|
||||
match unsubscribe {
|
||||
|
||||
Reference in New Issue
Block a user