perf: coordinate unknown id lookups

This is a huge improvement over what it was before. Now all unknown id
lookups are debounced and happen through a central coordinator. This
ensures there is no duplication between timelines.

Fixes: https://github.com/damus-io/notedeck/issues/279
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-09-02 17:35:59 -07:00
parent ad244d48c0
commit bc8a8d4a74
7 changed files with 324 additions and 224 deletions

View File

@@ -1,7 +1,6 @@
use crate::{actionbar::BarResult, timeline::TimelineSource, ui, Damus};
use nostrdb::{NoteKey, Transaction};
use std::collections::HashSet;
use tracing::warn;
use tracing::{error, warn};
pub struct ThreadView<'a> {
app: &'a mut Damus,
@@ -72,11 +71,8 @@ impl<'a> ThreadView<'a> {
};
// poll for new notes and insert them into our existing notes
{
let mut ids = HashSet::new();
let _ = TimelineSource::Thread(root_id)
.poll_notes_into_view(self.app, &mut ids);
// TODO: do something with unknown ids
if let Err(e) = TimelineSource::Thread(root_id).poll_notes_into_view(self.app) {
error!("Thread::poll_notes_into_view: {e}");
}
let (len, list) = {