From 0595c6d5cd45fbf34f8779be544df72f83647915 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 3 May 2019 04:02:15 +0000 Subject: [PATCH] Whitelist query limits for internal API When creating a merge request for push options, there may be over 100 queries that are run to create a merge request. Even after we reduce the number of queries by disabling the Sidekiq jobs, it appears we still hover near this limit. Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/11450 --- lib/api/internal.rb | 2 ++ spec/requests/api/internal_spec.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 00f0bbab231..c82fd230d7a 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -265,6 +265,8 @@ module API params[:changes], push_options.as_json) if Feature.enabled?(:mr_push_options, default_enabled: true) + Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/61359') + mr_options = push_options.get(:merge_request) output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present? end diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index 88c19448373..bae0302f3ff 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -959,7 +959,9 @@ describe API::Internal do it 'creates a new merge request' do expect do - post api('/internal/post_receive'), params: valid_params + Sidekiq::Testing.fake! do + post api('/internal/post_receive'), params: valid_params + end end.to change { MergeRequest.count }.by(1) end