commit ab08e678a9c2d1f9d51a3217854283c1e04bb907
parent e6efad025fcda58c6d5330edf20a1e4a7a833e0e
Author: William Casarin <jb55@jb55.com>
Date: Thu, 30 May 2024 12:38:55 +0200
filter: add default limit
This is just an opinionated default limit if we ever need it (we will)
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/enostr/src/filter.rs b/enostr/src/filter.rs
@@ -41,6 +41,14 @@ impl Filter {
}
}
+ pub fn default_limit() -> u16 {
+ 250
+ }
+
+ pub fn default_remote_limit() -> u16 {
+ 150
+ }
+
pub fn ids(mut self, ids: Vec<EventId>) -> Self {
self.ids = Some(ids);
self
diff --git a/src/app.rs b/src/app.rs
@@ -444,7 +444,9 @@ fn setup_initial_nostrdb_subs(damus: &mut Damus) -> Result<()> {
let results = damus.ndb.query(
&txn,
filters,
- damus.timelines[i].filter[0].limit.unwrap_or(200) as i32,
+ damus.timelines[i].filter[0]
+ .limit
+ .unwrap_or(enostr::Filter::default_limit()) as i32,
)?;
let filters = {