Commit 4ebf6f4d authored by Yorick Peterse's avatar Yorick Peterse Committed by Rémy Coutable

Merge branch 'sh-fix-issue-perf-order-by-issue' into 'master'

Improve issue load time performance by avoiding ORDER BY in find_by call

See merge request !6724
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent ede46e60
......@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.12.5
- Switch from request to env in ::API::Helpers. !6615
- Improve issue load time performance by avoiding ORDER BY in find_by call. !6724
v 8.12.4
- Fix "Copy to clipboard" tooltip to say "Copied!" when clipboard button is clicked. !6294 (lukehowell)
......
......@@ -159,7 +159,8 @@ class Projects::IssuesController < Projects::ApplicationController
protected
def issue
@noteable = @issue ||= @project.issues.find_by(iid: params[:id]) || redirect_old
# The Sortable default scope causes performance issues when used with find_by
@noteable = @issue ||= @project.issues.where(iid: params[:id]).reorder(nil).take || redirect_old
end
alias_method :subscribable_resource, :issue
alias_method :issuable, :issue
......
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