summaryrefslogtreecommitdiff
path: root/app/models/event.rb
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2018-11-14 06:07:35 +0100
committerGabriel Mazetto <brodock@gmail.com>2018-12-10 21:34:33 +0100
commit4f5abe43279e96efde5f8cac66cbff30d8a95f28 (patch)
tree931664a9662da2de4ce46781d2715f6426afc120 /app/models/event.rb
parent1297a1bd7dcccaa4e233925c8467c2bbe41a4bf2 (diff)
downloadgitlab-ce-4f5abe43279e96efde5f8cac66cbff30d8a95f28.tar.gz
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
Diffstat (limited to 'app/models/event.rb')
-rw-r--r--app/models/event.rb2
1 files changed, 1 insertions, 1 deletions
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