summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-31 09:06:36 +0000
committerRémy Coutable <remy@rymai.me>2017-03-31 09:06:36 +0000
commit7b708c65d54679a5dec27c654d102074246529a1 (patch)
treef7509000033fad2f92040f370f80fd0b578dd74d
parenta71e777bb722efdbe37b0f6bbd1a0aaef164a99f (diff)
parentced1bbab0cd981a23d653672a01e05c8c077fdc1 (diff)
downloadgitlab-ce-7b708c65d54679a5dec27c654d102074246529a1.tar.gz
Merge branch 'sh-fix-unnecessary-queries' into 'master'
Eliminate unnecessary queries that add ~500 ms of load time for a large issue See merge request !10365
-rw-r--r--app/models/project_team.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/project_team.rb b/app/models/project_team.rb
index 8a53e974b6f..6d6644053f8 100644
--- a/app/models/project_team.rb
+++ b/app/models/project_team.rb
@@ -169,6 +169,9 @@ class ProjectTeam
# Lookup only the IDs we need
user_ids = user_ids - access.keys
+
+ return access if user_ids.empty?
+
users_access = project.project_authorizations.
where(user: user_ids).
group(:user_id).