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

reintroduce topic cards with performance fix #6497

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

escattone
Copy link
Contributor

@escattone escattone commented Feb 7, 2025

mozilla/sumo#2180

Notes

  • This PR re-introduces all of the prior topics-card work in the first commit, and in the second commit, fixes the performance issue caused by the changes to get_featured_articles.
  • I've rewritten get_featured_articles so that's it's clearer, simpler, and much faster, and added thorough tests.
    • I've also removed the prefetch_related for each document's products and topics, because they're not used by any code that uses the featured articles. I think at one point in the iterations of the topic-cards work they were used, but that's no longer the case.
    • I've added select_related("current_revision") because that eliminates an N+1 query for each featured article's current revision to get the current revision's summary (this is done in the templates).
    • Finally, I've also added the exclusion of redirect documents.

@escattone escattone force-pushed the reintroduce-topic-cards-with-fix branch 3 times, most recently from b4cf25e to b20a2d7 Compare February 8, 2025 21:15

visits = visits[:10]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the change that killed the performance.

@escattone escattone merged commit 3efd3a6 into mozilla:main Feb 10, 2025
4 checks passed
@escattone escattone deleted the reintroduce-topic-cards-with-fix branch February 10, 2025 17:29
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.

2 participants