subs: switch to multiple-filter style

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-02-07 15:46:06 -08:00
parent 74ce87049d
commit f786d0568d
3 changed files with 10 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -2468,7 +2468,7 @@ dependencies = [
[[package]]
name = "nostrdb"
version = "0.1.6"
source = "git+https://github.com/damus-io/nostrdb-rs?rev=07c64d6f9956c3898ed0555c38aa5ed5bd482cd2#07c64d6f9956c3898ed0555c38aa5ed5bd482cd2"
source = "git+https://github.com/damus-io/nostrdb-rs?rev=a8f8fabdc2f1eebe939622000c030639b4b6d51f#a8f8fabdc2f1eebe939622000c030639b4b6d51f"
dependencies = [
"bindgen",
"cc",

View File

@@ -30,7 +30,7 @@ env_logger = "0.10.0"
shatter = "0.1.1"
puffin_egui = { version = "0.25.0", optional = true }
puffin = { version = "0.16.0", optional = true }
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "07c64d6f9956c3898ed0555c38aa5ed5bd482cd2" }
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "a8f8fabdc2f1eebe939622000c030639b4b6d51f" }
[features]
default = []

View File

@@ -153,9 +153,11 @@ fn try_process_event(damus: &mut Damus, ctx: &egui::Context) {
// do we have any new processed events?
if let Some(ref sub) = damus.home_sub {
let new_notes = damus.ndb.poll_for_notes(sub, 50);
if new_notes.len() > 0 {
info!("{} new notes! {:?}", new_notes.len(), new_notes);
let new_note_ids = damus.ndb.poll_for_notes(sub, 100);
if new_note_ids.len() > 0 {
info!("{} new notes! {:?}", new_note_ids.len(), new_note_ids);
for note in new_note_ids {}
}
}
}
@@ -167,7 +169,9 @@ fn setup_profiling() {
fn setup_initial_nostrdb_subs(damus: &mut Damus) -> Result<()> {
let filter: nostrdb::Filter = crate::filter::convert_enostr_filter(&get_home_filter());
damus.home_sub = Some(damus.ndb.subscribe(filter)?);
damus.home_sub = Some(damus.ndb.subscribe(vec![filter])?);
//damus.ndb.query()
Ok(())
}