Commit e0153c04 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'revert-9f929bc4' into 'master'

Revert "Add feature flag to update namespace statistics"

See merge request gitlab-org/gitlab!36033
parents 95a970ec c2409be8
......@@ -14,7 +14,6 @@ class ProjectStatistics < ApplicationRecord
COLUMNS_TO_REFRESH = [:repository_size, :wiki_size, :lfs_objects_size, :commit_count, :snippets_size].freeze
INCREMENTABLE_COLUMNS = { build_artifacts_size: %i[storage_size], packages_size: %i[storage_size] }.freeze
NAMESPACE_RELATABLE_COLUMNS = [:repository_size, :wiki_size, :lfs_objects_size].freeze
FLAGGED_NAMESPACE_RELATABLE_COLUMNS = [*NAMESPACE_RELATABLE_COLUMNS, :snippets_size].freeze
scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) }
......@@ -32,7 +31,7 @@ class ProjectStatistics < ApplicationRecord
end
end
if only.empty? || only.any? { |column| namespace_relatable_columns.include?(column) }
if only.empty? || only.any? { |column| NAMESPACE_RELATABLE_COLUMNS.include?(column) }
schedule_namespace_aggregation_worker
end
......@@ -111,10 +110,6 @@ class ProjectStatistics < ApplicationRecord
Namespaces::ScheduleAggregationWorker.perform_async(project.namespace_id)
end
end
def namespace_relatable_columns
Feature.enabled?(:namespace_snippets_size_stat) ? FLAGGED_NAMESPACE_RELATABLE_COLUMNS : NAMESPACE_RELATABLE_COLUMNS
end
end
ProjectStatistics.prepend_if_ee('EE::ProjectStatistics')
......@@ -189,26 +189,6 @@ RSpec.describe ProjectStatistics do
statistics.refresh!
end
end
context 'when snippets_size is updated' do
it 'schedules the aggregation worker' do
expect(Namespaces::ScheduleAggregationWorker)
.to receive(:perform_async)
statistics.refresh!(only: [:snippets_size])
end
context 'when feature flag :namespace_snippets_size_stat is disabled' do
it 'does not schedules an aggregation worker' do
stub_feature_flags(namespace_snippets_size_stat: false)
expect(Namespaces::ScheduleAggregationWorker)
.not_to receive(:perform_async)
statistics.refresh!(only: [:snippets_size])
end
end
end
end
context 'when the column is not namespace relatable' 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