diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-04 16:52:26 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-07 12:38:33 +0200 |
commit | bd08fff6c55bc13337b6501ff03bb7787decab68 (patch) | |
tree | da63c1fc8732209674b9b9dca26620d2b35e19e1 /app/controllers/dashboard | |
parent | ab738645a7b5bba46c8bf50f0780e66befc8bbe2 (diff) | |
download | gitlab-ce-bd08fff6c55bc13337b6501ff03bb7787decab68.tar.gz |
Eager load project creators for project dashboardsdashboard-projects-controller-query-performance
This solves an N+1 query problem where for every project we'd query the
creator separately just to figure out what avatar to display.
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 91c1e4dff79..74fe45e1ff6 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -45,8 +45,10 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController end def load_projects(finder_params) - ProjectsFinder.new(params: finder_params, current_user: current_user) - .execute.includes(:route, namespace: :route) + ProjectsFinder + .new(params: finder_params, current_user: current_user) + .execute + .includes(:route, :creator, namespace: :route) end def load_events |