From 4f5abe43279e96efde5f8cac66cbff30d8a95f28 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Wed, 14 Nov 2018 06:07:35 +0100 Subject: Reduce N+1 from Activity Dashboard and Banzai There is a combination of few strategies implemented here: 1. Few relations were eager loaded 2. Changed few polymorphic routes to specific ones so we don't have to use `#becomes(Namespace)` which doesn't preserve association cache --- app/models/event.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/event.rb') diff --git a/app/models/event.rb b/app/models/event.rb index 2e690f8c013..2ceef412af5 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -87,7 +87,7 @@ class Event < ActiveRecord::Base scope :with_associations, -> do # We're using preload for "push_event_payload" as otherwise the association # is not always available (depending on the query being built). - includes(:author, :project, project: :namespace) + includes(:author, :project, project: [:project_feature, :import_data, :namespace]) .preload(:target, :push_event_payload) end -- cgit v1.2.1