BigW Consortium Gitlab

Commit 4ddf0c69 by Douwe Maan Committed by LUKE BENNETT

Merge branch 'fix-event-target-author-preloading' into 'master'

Fix N+1 query when displaying events See merge request gitlab-org/gitlab-ce!15788 (cherry picked from commit 53026c42) c52a36e8 Fix N+1 query when displaying events
parent ea63ce0d
......@@ -72,7 +72,7 @@ class Event < ActiveRecord::Base
# 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)
.preload(:target, :push_event_payload)
.preload(:push_event_payload, target: :author)
end
scope :for_milestone_id, ->(milestone_id) { where(target_type: "Milestone", target_id: milestone_id) }
......
---
title: Fix N+1 query when displaying events
merge_request:
author:
type: performance
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment