Skip to content

AO3-7405 Prevent N+1 queries on tags#feed#5739

Open
Bilka2 wants to merge 3 commits intootwcode:masterfrom
Bilka2:AO3-7405-tags-feed-n-plus-one
Open

AO3-7405 Prevent N+1 queries on tags#feed#5739
Bilka2 wants to merge 3 commits intootwcode:masterfrom
Bilka2:AO3-7405-tags-feed-n-plus-one

Conversation

@Bilka2
Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 commented Apr 17, 2026

Issue

https://otwarchive.atlassian.net/browse/AO3-7405

Purpose

Prevent N+1 queries on tags#feed by using includes. The change in the feed builder itself is helpful because the previous code would get the works twice (once with limit 1 and once with limit 25), and that query is potentially quite slow. It's much faster to only do the limit 25 query and grab the date from the first work in the loop.

Failing test for the N+1 (and passing test for the feed date) pushed first to show that they're testing the right thing.

Credit

Bilka

@github-actions github-actions Bot added Scope: Tests Only Only changes automated tests or test configuration Awaiting Review labels Apr 17, 2026
@Bilka2 Bilka2 removed the Scope: Tests Only Only changes automated tests or test configuration label Apr 17, 2026
Copy link
Copy Markdown
Member

@brianjaustin brianjaustin left a comment

Choose a reason for hiding this comment

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

Thanks! (Just one unrelated thing that doesn't have to be addressed if you'd rather not)

Comment thread app/controllers/tags_controller.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants