Skip to content

Commit

Permalink
cap size of remote filter limits
Browse files Browse the repository at this point in the history
I noticed the responses are a bit slow without this. Local query limits
are not capped.

Fixes: #98
Changelog-Changed: Restrict remote filter sizes to 250 (for now)
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed May 27, 2024
1 parent c1cf7ea commit 2af4464
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2af4464

Please sign in to comment.