Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_statistics.rb')
-rw-r--r--app/models/project_statistics.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb
index f153bfe3f5b..67ab2c0ce8a 100644
--- a/app/models/project_statistics.rb
+++ b/app/models/project_statistics.rb
@@ -12,13 +12,17 @@ class ProjectStatistics < ApplicationRecord
before_save :update_storage_size
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], snippets_size: %i[storage_size] }.freeze
+ INCREMENTABLE_COLUMNS = {
+ build_artifacts_size: %i[storage_size],
+ packages_size: %i[storage_size],
+ pipeline_artifacts_size: %i[storage_size],
+ snippets_size: %i[storage_size]
+ }.freeze
NAMESPACE_RELATABLE_COLUMNS = [:repository_size, :wiki_size, :lfs_objects_size].freeze
scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) }
scope :for_namespaces, -> (namespaces) { where(namespace: namespaces) }
- scope :with_any_ci_minutes_used, -> { where.not(shared_runners_seconds: 0) }
def total_repository_size
repository_size + lfs_objects_size
@@ -80,6 +84,10 @@ class ProjectStatistics < ApplicationRecord
# might try to update project statistics before the `snippets_size` column has been created.
storage_size += snippets_size if self.class.column_names.include?('snippets_size')
+ # The `pipeline_artifacts_size` column was added on 20200817142800 but db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb
+ # might try to update project statistics before the `pipeline_artifacts_size` column has been created.
+ storage_size += pipeline_artifacts_size if self.class.column_names.include?('pipeline_artifacts_size')
+
self.storage_size = storage_size
end