Commit 58ee1738 authored by Robert May's avatar Robert May

Enable repository API rate limit cache

Changelog: performance
parent f536b8cd
---
name: api_caching_rate_limit_repository_compare
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64407
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334264
milestone: '14.1'
type: development
group: group::source code
default_enabled: true
...@@ -171,7 +171,6 @@ module API ...@@ -171,7 +171,6 @@ module API
optional :straight, type: Boolean, desc: 'Comparison method, `true` for direct comparison between `from` and `to` (`from`..`to`), `false` to compare using merge base (`from`...`to`)', default: false optional :straight, type: Boolean, desc: 'Comparison method, `true` for direct comparison between `from` and `to` (`from`..`to`), `false` to compare using merge base (`from`...`to`)', default: false
end end
get ':id/repository/compare', urgency: :low do get ':id/repository/compare', urgency: :low do
ff_enabled = Feature.enabled?(:api_caching_rate_limit_repository_compare, user_project, default_enabled: :yaml)
target_project = fetch_target_project(current_user, user_project, params) target_project = fetch_target_project(current_user, user_project, params)
if target_project.blank? if target_project.blank?
...@@ -180,7 +179,7 @@ module API ...@@ -180,7 +179,7 @@ module API
cache_key = compare_cache_key(current_user, user_project, target_project, declared_params) cache_key = compare_cache_key(current_user, user_project, target_project, declared_params)
cache_action_if(ff_enabled, cache_key, expires_in: 1.minute) do cache_action(cache_key, expires_in: 1.minute) do
compare = CompareService.new(user_project, params[:to]).execute(target_project, params[:from], straight: params[:straight]) compare = CompareService.new(user_project, params[:to]).execute(target_project, params[:from], straight: params[:straight])
if compare if compare
......
...@@ -561,17 +561,6 @@ RSpec.describe API::Repositories do ...@@ -561,17 +561,6 @@ RSpec.describe API::Repositories do
let(:request) { get api(route, guest) } let(:request) { get api(route, guest) }
end end
end end
context 'api_caching_rate_limit_repository_compare is disabled' do
before do
stub_feature_flags(api_caching_rate_limit_repository_compare: false)
end
it_behaves_like 'repository compare' do
let(:project) { create(:project, :public, :repository) }
let(:current_user) { nil }
end
end
end end
describe 'GET /projects/:id/repository/contributors' do describe 'GET /projects/:id/repository/contributors' do
......
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