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 <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-05-27 09:25:18 -07:00
parent c1cf7ea324
commit 2af44641db

View File

@@ -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;