BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4ddf0c69
Commit
4ddf0c69
authored
Dec 08, 2017
by
Douwe Maan
Committed by
LUKE BENNETT
Dec 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
event.rb
app/models/event.rb
+1
-1
fix-event-target-author-preloading.yml
changelogs/unreleased/fix-event-target-author-preloading.yml
+5
-0
No files found.
app/models/event.rb
View file @
4ddf0c69
...
...
@@ -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
)
}
...
...
changelogs/unreleased/fix-event-target-author-preloading.yml
0 → 100644
View file @
4ddf0c69
---
title
:
Fix N+1 query when displaying events
merge_request
:
author
:
type
:
performance
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment