Commit a3542f83 authored by Sean McGivern's avatar Sean McGivern

Merge branch '341681-feature-flag-check-gap-fix' into 'master'

Memoize feature flag call in MergeRequests::AfterCreateService

See merge request gitlab-org/gitlab!75717
parents cba3a15c 57cd09b3
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module MergeRequests module MergeRequests
class AfterCreateService < MergeRequests::BaseService class AfterCreateService < MergeRequests::BaseService
include Gitlab::Utils::StrongMemoize
def execute(merge_request) def execute(merge_request)
prepare_for_mergeability(merge_request) if early_prepare_for_mergeability?(merge_request) prepare_for_mergeability(merge_request) if early_prepare_for_mergeability?(merge_request)
prepare_merge_request(merge_request) prepare_merge_request(merge_request)
...@@ -48,8 +50,10 @@ module MergeRequests ...@@ -48,8 +50,10 @@ module MergeRequests
end end
def early_prepare_for_mergeability?(merge_request) def early_prepare_for_mergeability?(merge_request)
strong_memoize("early_prepare_for_mergeability_#{merge_request.target_project_id}".to_sym) do
Feature.enabled?(:early_prepare_for_mergeability, merge_request.target_project) Feature.enabled?(:early_prepare_for_mergeability, merge_request.target_project)
end end
end
def mark_as_unchecked(merge_request) def mark_as_unchecked(merge_request)
merge_request.mark_as_unchecked if merge_request.preparing? merge_request.mark_as_unchecked if merge_request.preparing?
......
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