Commit d2e17c0c authored by David Kim's avatar David Kim

Merge branch 'remove-ff-idempotent-ci-minutes-consumption' into 'master'

Remove feature flag idempotent_ci_minutes_consumption

See merge request gitlab-org/gitlab!71840
parents 97c74f9f f82d4f06
...@@ -7,7 +7,7 @@ module Ci ...@@ -7,7 +7,7 @@ module Ci
IDEMPOTENCY_CACHE_TTL = 12.hours IDEMPOTENCY_CACHE_TTL = 12.hours
def initialize(project_id, namespace_id, build_id = nil) def initialize(project_id, namespace_id, build_id)
@project_id = project_id @project_id = project_id
@namespace_id = namespace_id @namespace_id = namespace_id
@build_id = build_id @build_id = build_id
...@@ -19,14 +19,7 @@ module Ci ...@@ -19,14 +19,7 @@ module Ci
def execute(consumption) def execute(consumption)
legacy_track_usage_of_monthly_minutes(consumption) legacy_track_usage_of_monthly_minutes(consumption)
# TODO: fix this condition after the next deployment when `build_id` ensure_idempotency { track_usage_of_monthly_minutes(consumption) }
# is made a mandatory argument.
# https://gitlab.com/gitlab-org/gitlab/-/issues/331785
if @build_id && idempotent_consumption_enabled?
ensure_idempotency { track_usage_of_monthly_minutes(consumption) }
else
track_usage_of_monthly_minutes(consumption)
end
send_minutes_email_notification send_minutes_email_notification
end end
...@@ -134,15 +127,6 @@ module Ci ...@@ -134,15 +127,6 @@ module Ci
redis.exists(idempotency_cache_key) redis.exists(idempotency_cache_key)
end end
end end
# When running this worker the project might have been deleted.
# In this case we consider the feature flag disabled for backward
# compatibility.
def idempotent_consumption_enabled?
return false unless @project
Feature.enabled?(:idempotent_ci_minutes_consumption, @project, default_enabled: :yaml)
end
end end
end end
end end
---
name: idempotent_ci_minutes_consumption
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69994
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340517
milestone: '14.4'
type: development
group: group::pipeline execution
default_enabled: false
...@@ -143,10 +143,8 @@ RSpec.describe Ci::Minutes::UpdateProjectAndNamespaceUsageService do ...@@ -143,10 +143,8 @@ RSpec.describe Ci::Minutes::UpdateProjectAndNamespaceUsageService do
it 'does not create nested transactions', :delete do it 'does not create nested transactions', :delete do
expect(ApplicationRecord.connection.transaction_open?).to be false expect(ApplicationRecord.connection.transaction_open?).to be false
service = described_class.new(project.id, namespace.id)
queries = ActiveRecord::QueryRecorder.new do queries = ActiveRecord::QueryRecorder.new do
service subject
end end
savepoints = queries.occurrences.keys.flatten.select do |query| savepoints = queries.occurrences.keys.flatten.select do |query|
...@@ -194,20 +192,6 @@ RSpec.describe Ci::Minutes::UpdateProjectAndNamespaceUsageService do ...@@ -194,20 +192,6 @@ RSpec.describe Ci::Minutes::UpdateProjectAndNamespaceUsageService do
subject subject
end end
context 'when feature flag idempotent_ci_minutes_consumption is disabled' do
before do
stub_feature_flags(idempotent_ci_minutes_consumption: false)
end
it_behaves_like 'updates monthly consumption'
end
context 'when build_id is not provided as parameter' do
let(:service) { described_class.new(project.id, namespace.id) }
it_behaves_like 'updates monthly consumption' # not idempotent / temporary backwards compatibility
end
end end
end end
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