diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-22 20:01:28 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-22 20:01:28 +0000 |
commit | 3f7ac28806983c9b13e40856685aeb0d494ccb4d (patch) | |
tree | d9a10a50aa60ce5d9d2ec9d955cb0deb17d37517 | |
parent | fa4eeb499dd789a85abf4f6ace3cc7fd1071523b (diff) | |
parent | df541e510e5da0949286aa73a24ad748bc2d05c6 (diff) | |
download | gitlab-ce-3f7ac28806983c9b13e40856685aeb0d494ccb4d.tar.gz |
Merge branch 'fix/load-project-invited-groups-and-members-eagerly' into 'master'
Load project invited groups and members eagerly in ProjectTeam#fetch_members
## What does this MR do?
Load project invited groups and members eagerly in `ProjectTeam#fetch_members`, reducing number of queries to DB.
## Are there points in the code the reviewer needs to double check?
N/A
## Why was this MR needed?
`ProjectTeam#fetch_members` is part of the code path of `Participable#raw_participants`, so it should improve its performance a bit.
## What are the relevant issue numbers?
#19985
## Screenshots (if relevant)
N/A
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- ~~[ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- ~~[ ] API support added~~
- ~~Tests~~
- ~~[ ] Added for this feature/bug~~
- ~~[ ] All builds are passing~~
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5436
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/project_team.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index e2104338f5c..fa272755033 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ v 8.11.0 (unreleased) - Fix of 'Commits being passed to custom hooks are already reachable when using the UI' - Limit git rev-list output count to one in forced push check - Retrieve rendered HTML from cache in one request + - Load project invited groups and members eagerly in ProjectTeam#fetch_members v 8.10.0 - Fix profile activity heatmap to show correct day name (eanplatter) diff --git a/app/models/project_team.rb b/app/models/project_team.rb index 0b700930641..9d312a53790 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -173,7 +173,7 @@ class ProjectTeam invited_members = [] if project.invited_groups.any? && project.allowed_to_share_with_group? - project.project_group_links.each do |group_link| + project.project_group_links.includes(group: [:group_members]).each do |group_link| invited_group = group_link.group im = invited_group.members |