summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-02 17:29:45 +0100
committerSean McGivern <sean@gitlab.com>2017-05-02 17:35:19 +0100
commit52d049b4f82b1a3ed358188e02ab3518e5eae5fa (patch)
tree19a0d52cb4910921d5c4599eb21de02ca35bc987
parent6277bda61c511696f9d12fae4238b5214a722571 (diff)
downloadgitlab-ce-fix-n-plus-one-project-features.tar.gz
Remove N+1 queries when checking nodes visible to userfix-n-plus-one-project-features
N in this case is low, as it's the number of distinct projects referenced from MRs, rather than the number of MRs referenced (issues use their own optimization). Still, on issues or MRs which are often referenced from MRs, it will save a few queries.
-rw-r--r--changelogs/unreleased/fix-n-plus-one-project-features.yml4
-rw-r--r--lib/banzai/reference_parser/merge_request_parser.rb3
2 files changed, 6 insertions, 1 deletions
diff --git a/changelogs/unreleased/fix-n-plus-one-project-features.yml b/changelogs/unreleased/fix-n-plus-one-project-features.yml
new file mode 100644
index 00000000000..1b19bd65224
--- /dev/null
+++ b/changelogs/unreleased/fix-n-plus-one-project-features.yml
@@ -0,0 +1,4 @@
+---
+title: Remove N+1 queries in processing MR references
+merge_request:
+author:
diff --git a/lib/banzai/reference_parser/merge_request_parser.rb b/lib/banzai/reference_parser/merge_request_parser.rb
index 84a28b33d7c..8b0662749fd 100644
--- a/lib/banzai/reference_parser/merge_request_parser.rb
+++ b/lib/banzai/reference_parser/merge_request_parser.rb
@@ -33,7 +33,8 @@ module Banzai
{ namespace: :owner },
{ group: [:owners, :group_members] },
:invited_groups,
- :project_members
+ :project_members,
+ :project_feature
]
}),
self.class.data_attribute