Class: Gitlab::BackgroundMigration::BackfillProjectStatisticsStorageSizeWithRecentSize::ProjectStatistics
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Gitlab::BackgroundMigration::BackfillProjectStatisticsStorageSizeWithRecentSize::ProjectStatistics
- Includes:
- EachBatch
- Defined in:
- lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb
Constant Summary
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Instance Method Summary collapse
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Instance Method Details
#update_repository_size ⇒ Object
74 75 76 |
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 74 def update_repository_size self.repository_size = project.repository.recent_objects_size.megabytes end |
#update_storage_size(storage_size_components) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 78 def update_storage_size(storage_size_components) return unless repository_size > 0 update_repository_size new_storage_size = storage_size_components.sum { |component| method(component).call } # Only update storage_size if storage_size needs updating return unless storage_size != new_storage_size self.storage_size = new_storage_size save! ::Namespaces::ScheduleAggregationWorker.perform_async(project.namespace_id) log_with_data('Scheduled Namespaces::ScheduleAggregationWorker') end |