Skip to content
Snippets Groups Projects
Commit 297b075b authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Merge branch 'sh-fix-rebase-in-progress-nplus-one' into 'master'

Memoize MergeRequest#rebase_in_progress? to prevent N+1 queries in Gitaly

Closes gitlab-ee#4857

See merge request gitlab-org/gitlab-ce!16990
parents 2d3867d0 9a323c7e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -158,10 +158,12 @@ class MergeRequest < ActiveRecord::Base
end
 
def rebase_in_progress?
# The source project can be deleted
return false unless source_project
strong_memoize(:rebase_in_progress) do
# The source project can be deleted
next false unless source_project
 
source_project.repository.rebase_in_progress?(id)
source_project.repository.rebase_in_progress?(id)
end
end
 
# Use this method whenever you need to make sure the head_pipeline is synced with the
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment