Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gate to increase post-feed page size #5473

Merged
merged 5 commits into from
Sep 25, 2024
Merged

Conversation

estrattonbailey
Copy link
Member

Feeds that don't do language filtering themselves return all results to the client, where we do our best to filter by the user's contentLanguages. If we get no good results back, we "bail out" and return the raw results, which may all be in a different language.

This PR adds a flag so we can test upping this fetch limit to see if that improves how many posts we get back in the user's language.

@arcalinea arcalinea temporarily deployed to increase-fetch-window - social-app PR #5473 September 24, 2024 18:55 — with Render Destroyed
Copy link

github-actions bot commented Sep 24, 2024

Old size New size Diff
10.38 MB 10.38 MB 42 B (0.00%)

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's more logic that uses PAGE_SIZE — notably, the logic that ensures we have enough posts fetched in cases some of them get filtered out. i think you probably want to adjust that logic too.

i would suggest just removing the PAGE_SIZE constant altogether so that we're not tempted to use it accidentally.

@estrattonbailey
Copy link
Member Author

@gaearon right right, I should have explained this better or named things better.

My thinking is is that we have two numbers here: the min number of posts we want to fill a screen (rn it's 30), and the fetch limit. That fetch limit is what I think we need to bump here, because that will ensure that we fill at least 30 posts for the view. If we increase the min posts we want to 100, we'll be doing likely about the same number of requests, and each request is now heavier than before.

That sound reasonable? My latest commit adds some clarification, good call on not wanting to confuse the const.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok thanks for explaining, makes sense

*/
const fetchLimit = React.useState(() => {
return gate('post_feed_lang_window') ? 100 : MIN_POSTS
})[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can just be

const fetchLimit = gate('post_feed_lang_window') ? 100 : MIN_POSTS

because gates are cached per-user in memory

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, thanks!

@arcalinea arcalinea temporarily deployed to increase-fetch-window - social-app PR #5473 September 25, 2024 15:10 — with Render Destroyed
@estrattonbailey estrattonbailey merged commit 224ff42 into main Sep 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants