Commit 9a323c7e authored by Stan Hu's avatar Stan Hu Committed by Sean McGivern

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

MergeRequest#rebase_in_progress? and MergeRequest#rebase_path were called
twice each time per request. This memoization helps reduce the overall number
of queries.

See as a failing

Closes gitlab-ee#4857
parent 828357fb
Pipeline #17256378 passed with stages
in 30 minutes and 30 seconds
......@@ -158,10 +158,12 @@ class MergeRequest < ActiveRecord::Base
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
# Use this method whenever you need to make sure the head_pipeline is synced with the
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