Resolve "Banzai::Filter::MergeRequestReferenceFilter has three N+1 query problems"
requested to merge 30098-banzai-filter-mergerequestreferencefilter-has-an-n-1-query-problem into master
What does this MR do?
This merge request fixes 3 different N+1 query problems in Banzai::Filter::MergeRequestReferenceFilter
.
Basically, I re-used the approach from Banzai::Filter::IssueReferenceFilter
, and I had to add .includes(target_project: :namespace)
for the 3rd N+1 query problem (this wasn't needed for issue, probably because the associated project's namespaces are automatically preloaded, but for merge requests, the association is named target_project
instead of project
so...).
Before | After |
---|---|
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Does this MR meet the acceptance criteria?
-
No Changelog entry needed. - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
Closes #30098 (closed) /cc @stanhu