Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-10-06 22:57:16 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-10-06 22:57:16 +0300
commit6c405b951ead1bd58a64dd4f5e713abaada6dffc (patch)
tree277ff9a0503288b3e02fb12a7de0b92b2b0e6e22 /app
parentc230946e32ab4a0f33034675051d4fd61b5095d4 (diff)
parentaada01030cd23719a54a4e499b72c12f95ce0d24 (diff)
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
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/issues_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index ef13e0677d2..96041b07647 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -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