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

Hotfix/Eagerly load scores in feed #1

Merged
merged 1 commit into from
Oct 12, 2022

Conversation

AdrianPascanTOL
Copy link
Owner

@AdrianPascanTOL AdrianPascanTOL commented Oct 11, 2022

Fixes: #1

Changes

Uses includes method instead of all method on the Score model in the ScoresController.user_feed function, switching from lazily loading to eagerly loading the scores feed and solving the n+1 queries problem.

Before

Screenshot 2022-10-11 at 10 56 34

After

Screenshot 2022-10-11 at 11 07 13

@AdrianPascanTOL AdrianPascanTOL changed the title Eagerly load scores in feed Hotfix/Eagerly load scores in feed Oct 11, 2022
@AACraiu
Copy link
Collaborator

AACraiu commented Oct 12, 2022

You can still use .all with .includes. Something like .all.includes...

@AACraiu AACraiu merged commit 8ea9c41 into main Oct 12, 2022
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.

Improve scores feed performance
2 participants