diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index fb0ad178c91425f886d1a99580f3bb29e0edcd17..7f7b2724f745eedeaacb957fc2e7d07393b9a0c4 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -22,7 +22,7 @@ class ProjectStatistics < ApplicationRecord before_save :update_storage_size COLUMNS_TO_REFRESH = [:repository_size, :wiki_size, :lfs_objects_size, :commit_count, :snippets_size, :uploads_size, :container_registry_size].freeze - INCREMENTABLE_COLUMNS = { + LEGACY_INCREMENTABLE_COLUMNS = { packages_size: %i[storage_size], # remove this along with packages_size_counter_attribute pipeline_artifacts_size: %i[storage_size], snippets_size: %i[storage_size] @@ -123,7 +123,7 @@ def refresh_storage_size! # For counter attributes, storage_size will be refreshed after the counter is flushed, # through counter_attribute_after_flush # - # For non-counter attributes, storage_size is updated depending on key => [columns] in INCREMENTABLE_COLUMNS + # For non-counter attributes, storage_size is updated depending on key => [columns] in LEGACY_INCREMENTABLE_COLUMNS def self.increment_statistic(project, key, amount) project.statistics.try do |project_statistics| project_statistics.increment_statistic(key, amount) @@ -151,7 +151,7 @@ def legacy_increment_statistic(key, amount) private def incrementable_attribute?(key) - INCREMENTABLE_COLUMNS.key?(key) || counter_attribute_enabled?(key) + LEGACY_INCREMENTABLE_COLUMNS.key?(key) || counter_attribute_enabled?(key) end def storage_size_components @@ -164,7 +164,7 @@ def storage_size_sum def increment_columns!(key, amount) increments = { key => amount } - additional = INCREMENTABLE_COLUMNS.fetch(key, []) + additional = LEGACY_INCREMENTABLE_COLUMNS.fetch(key, []) additional.each do |column| increments[column] = amount end