From 2af44641db6e9c2c63ddf7b76938b8d3168f882f Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 27 May 2024 09:25:18 -0700 Subject: [PATCH] cap size of remote filter limits I noticed the responses are a bit slow without this. Local query limits are not capped. Fixes: https://github.com/damus-io/notedeck/issues/98 Changelog-Changed: Restrict remote filter sizes to 250 (for now) Signed-off-by: William Casarin --- src/app.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app.rs b/src/app.rs index d529c8d..fd10d37 100644 --- a/src/app.rs +++ b/src/app.rs @@ -97,6 +97,12 @@ fn send_initial_filters(damus: &mut Damus, relay_url: &str) { let mut filter = timeline.filter.clone(); for f in &mut filter { since_optimize_filter(f, timeline.notes(ViewFilter::NotesAndReplies)); + + // limit the size of remote filters + let lim = f.limit.unwrap_or(100); + if lim > 150 { + f.limit = Some(150); + } } relay.subscribe(format!("initial{}", c), filter); c += 1;