Class: Gitlab::BackgroundMigration::CalculateWikiSizes

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/calculate_wiki_sizes.rb

Instance Method Summary collapse

Instance Method Details

#perform(start_id, stop_id) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'lib/gitlab/background_migration/calculate_wiki_sizes.rb', line 7

def perform(start_id, stop_id)
  ::ProjectStatistics.where(wiki_size: nil)
    .where(id: start_id..stop_id)
    .includes(project: [:route, :group, namespace: [:owner]]).find_each do |statistics|
    statistics.refresh!(only: [:wiki_size])
  rescue => e
    Gitlab::AppLogger.error "Failed to update wiki statistics. id: #{statistics.id} message: #{e.message}"
  end
end