Commit 2e1ee9d8 authored by James Lopez's avatar James Lopez

Merge branch 'pnp-bust-cache' into 'master'

Add PnP feature flag to bust cache

See merge request gitlab-org/gitlab!52437
parents e7e638b5 e711c39f
...@@ -42,7 +42,13 @@ class FetchSubscriptionPlansService ...@@ -42,7 +42,13 @@ class FetchSubscriptionPlansService
end end
def cache_key def cache_key
if Feature.enabled?(:subscription_plan_cache_key) if Feature.enabled?(:pnp_subscription_plan_cache_key)
if @namespace_id.present?
"pnp-subscription-plan-#{@plan}-#{@namespace_id}"
else
"pnp-subscription-plan-#{@plan}"
end
elsif Feature.enabled?(:subscription_plan_cache_key)
if @namespace_id.present? if @namespace_id.present?
"subscription-plan-#{@plan}-#{@namespace_id}" "subscription-plan-#{@plan}-#{@namespace_id}"
else else
......
---
name: pnp_subscription_plan_cache_key
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52437
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/299068
type: development
group: group::fulfillment
default_enabled: false
...@@ -27,7 +27,7 @@ RSpec.describe FetchSubscriptionPlansService do ...@@ -27,7 +27,7 @@ RSpec.describe FetchSubscriptionPlansService do
it 'uses only the plan within the cache key name' do it 'uses only the plan within the cache key name' do
allow(Gitlab::HTTP).to receive(:get).and_return(response_mock) allow(Gitlab::HTTP).to receive(:get).and_return(response_mock)
expect(Rails.cache).to receive(:read).with("subscription-plan-#{plan}") expect(Rails.cache).to receive(:read).with("pnp-subscription-plan-#{plan}")
execute_service execute_service
end end
...@@ -53,7 +53,7 @@ RSpec.describe FetchSubscriptionPlansService do ...@@ -53,7 +53,7 @@ RSpec.describe FetchSubscriptionPlansService do
it 'uses the namespace id within the cache key name' do it 'uses the namespace id within the cache key name' do
allow(Gitlab::HTTP).to receive(:get).and_return(response_mock) allow(Gitlab::HTTP).to receive(:get).and_return(response_mock)
expect(Rails.cache).to receive(:read).with("subscription-plan-#{plan}-#{namespace_id}") expect(Rails.cache).to receive(:read).with("pnp-subscription-plan-#{plan}-#{namespace_id}")
execute_service execute_service
end end
......
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