Skip to content

Commit

Permalink
Increase RSS fetch limit to 20. Fixes #2319
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Jun 22, 2022
1 parent dc35ab9 commit e26ced3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/routes/src/feeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ use serde::Deserialize;
use std::{collections::BTreeMap, str::FromStr};
use strum::ParseError;

const RSS_FETCH_LIMIT: i64 = 20;

#[derive(Deserialize)]
struct Params {
sort: Option<String>,
Expand Down Expand Up @@ -91,6 +93,7 @@ async fn get_feed_data(
PostQueryBuilder::create(conn)
.listing_type(listing_type)
.sort(sort_type)
.limit(RSS_FETCH_LIMIT)
.list()
})
.await??;
Expand Down Expand Up @@ -184,6 +187,7 @@ fn get_feed_user(
.listing_type(ListingType::All)
.sort(*sort_type)
.creator_id(person.id)
.limit(RSS_FETCH_LIMIT)
.list()?;

let items = create_post_items(posts, protocol_and_hostname)?;
Expand Down Expand Up @@ -212,6 +216,7 @@ fn get_feed_community(
.listing_type(ListingType::Community)
.sort(*sort_type)
.community_id(community.id)
.limit(RSS_FETCH_LIMIT)
.list()?;

let items = create_post_items(posts, protocol_and_hostname)?;
Expand Down Expand Up @@ -248,6 +253,7 @@ fn get_feed_front(
.show_bot_accounts(local_user.show_bot_accounts)
.show_read_posts(local_user.show_read_posts)
.sort(*sort_type)
.limit(RSS_FETCH_LIMIT)
.list()?;

let items = create_post_items(posts, protocol_and_hostname)?;
Expand Down Expand Up @@ -286,12 +292,14 @@ fn get_feed_inbox(
.my_person_id(person_id)
.show_bot_accounts(show_bot_accounts)
.sort(sort)
.limit(RSS_FETCH_LIMIT)
.list()?;

let mentions = PersonMentionQueryBuilder::create(conn)
.recipient_id(person_id)
.my_person_id(person_id)
.sort(sort)
.limit(RSS_FETCH_LIMIT)
.list()?;

let items = create_reply_and_mention_items(replies, mentions, protocol_and_hostname)?;
Expand Down

0 comments on commit e26ced3

Please sign in to comment.