-
- Downloads
There was an error fetching the commit references. Please try again later.
Eliminate N+1 queries in loading discussions.json endpoint
In #37955,we see that the profile had a number of N+1 queries from repeated access to `cross_reference_not_visible_for?`. This was optimized in previous versions of GitLab by rendering all notes at once, counting the number of visible references, and then using that number to check whether a system note should be fully redacted. There was also another N+1 query calling `ProjectTeam#member?`, which did not take advantage of an optimization in prepare_notes_for_rendering that would preload the maximum access level per project. Closes #37955
Showing
- app/controllers/projects/issues_controller.rb 2 additions, 2 deletionsapp/controllers/projects/issues_controller.rb
- app/models/project_team.rb 1 addition, 1 deletionapp/models/project_team.rb
- changelogs/unreleased/sh-optimize-discussion-json.yml 5 additions, 0 deletionschangelogs/unreleased/sh-optimize-discussion-json.yml
- spec/controllers/projects/issues_controller_spec.rb 32 additions, 0 deletionsspec/controllers/projects/issues_controller_spec.rb
Please register or sign in to comment