Commit f47b6c0a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'remove-ff-update-project-statistics-after-commit' into 'master'

Remove update_project_statistics_after_commit feature flag

See merge request gitlab-org/gitlab!30818
parents 4ed3762b 49d3e7c1
...@@ -68,21 +68,11 @@ module UpdateProjectStatistics ...@@ -68,21 +68,11 @@ module UpdateProjectStatistics
def schedule_update_project_statistic(delta) def schedule_update_project_statistic(delta)
return if delta.zero? return if delta.zero?
return if project.nil?
if Feature.enabled?(:update_project_statistics_after_commit, default_enabled: true)
# Update ProjectStatistics after the transaction
run_after_commit do run_after_commit do
ProjectStatistics.increment_statistic( ProjectStatistics.increment_statistic(
project_id, self.class.project_statistics_name, delta) project_id, self.class.project_statistics_name, delta)
end
else
# Use legacy-way to update within transaction
ProjectStatistics.increment_statistic(
project_id, self.class.project_statistics_name, delta)
end
run_after_commit do
next if project.nil?
Namespaces::ScheduleAggregationWorker.perform_async( Namespaces::ScheduleAggregationWorker.perform_async(
project.namespace_id) project.namespace_id)
......
...@@ -19,25 +19,9 @@ describe Ci::JobArtifact do ...@@ -19,25 +19,9 @@ describe Ci::JobArtifact do
it_behaves_like 'having unique enum values' it_behaves_like 'having unique enum values'
context 'with update_project_statistics_after_commit enabled' do
before do
stub_feature_flags(update_project_statistics_after_commit: true)
end
it_behaves_like 'UpdateProjectStatistics' do
subject { build(:ci_job_artifact, :archive, size: 107464) }
end
end
context 'with update_project_statistics_after_commit disabled' do
before do
stub_feature_flags(update_project_statistics_after_commit: false)
end
it_behaves_like 'UpdateProjectStatistics' do it_behaves_like 'UpdateProjectStatistics' do
subject { build(:ci_job_artifact, :archive, size: 107464) } subject { build(:ci_job_artifact, :archive, size: 107464) }
end end
end
describe '.with_reports' do describe '.with_reports' do
let!(:artifact) { create(:ci_job_artifact, :archive) } let!(:artifact) { create(:ci_job_artifact, :archive) }
......
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