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

Cache CommunityUser post counts #1411

Open
cellio opened this issue Sep 20, 2024 · 0 comments
Open

Cache CommunityUser post counts #1411

cellio opened this issue Sep 20, 2024 · 0 comments
Labels
area: ruby Changes to server-side code complexity: easy Issues that should take limited effort to resolve/fix/build. priority: medium type: bug Something isn't working

Comments

@cellio
Copy link
Member

cellio commented Sep 20, 2024

#1409 adds the "all communities" tab on the user profile, which shows that user's profiles on the rest of the network with some stats, currently just reputation and number of posts. Getting the number of posts per profile could get expensive at scale. Instead, we should cache this and update when posts are added or deleted.

We are already using counter_culture in a couple other places and could use it here to address this. We need to add a post_count counter to the CommunityUser model; CU doesn't have a direct relation to Post but can get there through User (has_many :posts, through: :user should do that, I think). The rest of the work is to add the counter_culture declaration and make it work for adding or deleting posts. That's the part I couldn't figure out, so we're spinning this off as a new issue.

@cellio cellio added area: ruby Changes to server-side code type: bug Something isn't working priority: medium complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Sep 20, 2024
@Oaphi Oaphi added complexity: easy Issues that should take limited effort to resolve/fix/build. and removed complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ruby Changes to server-side code complexity: easy Issues that should take limited effort to resolve/fix/build. priority: medium type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants