Class: Gitlab::BackgroundMigration::PopulateNamespaceStatistics

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

Overview

This class creates/updates those namespace statistics that haven't been created nor initialized. It also updates the related namespace statistics

Instance Method Summary collapse

Instance Method Details

#perform(group_ids, statistics) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/background_migration/populate_namespace_statistics.rb', line 9

def perform(group_ids, statistics)
  # Updating group statistics might involve calling Gitaly.
  # For example, when calculating `wiki_size`, we will need
  # to perform the request to check if the repo exists and
  # also the repository size.
  #
  # The `allow_n_plus_1_calls` method is only intended for
  # dev and test. It won't be raised in prod.
  ::Gitlab::GitalyClient.allow_n_plus_1_calls do
    relation(group_ids).each do |group|
      upsert_namespace_statistics(group, statistics)
    end
  end
end