Eager load namespace owners for project dashboards

This solves an N+1 query problem where we'd run multiple queries when
getting the namespace owners of the displayed projects.
This commit is contained in:
Yorick Peterse 2017-09-11 16:05:14 +02:00
parent 5cc140b202
commit 615ba0071a
No known key found for this signature in database
GPG Key ID: EDD30D2BEB691AC9
2 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
ProjectsFinder
.new(params: finder_params, current_user: current_user)
.execute
.includes(:route, :creator, namespace: :route)
.includes(:route, :creator, namespace: [:route, :owner])
end
def load_events

View File

@ -0,0 +1,5 @@
---
title: Eager load namespace owners for project dashboards
merge_request:
author:
type: other