Class: Gitlab::ImportExport::StatisticsRestorer

Inherits:
Object
  • Object
show all
Includes:
Import::Framework::ProgressTracking
Defined in:
lib/gitlab/import_export/statistics_restorer.rb

Constant Summary

Constants included from Import::Framework::ProgressTracking

Import::Framework::ProgressTracking::CACHE_EXPIRATION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Import::Framework::ProgressTracking

#processed_entry?, #save_processed_entry, #with_progress_tracking

Constructor Details

#initialize(project:, shared:) ⇒ StatisticsRestorer

Returns a new instance of StatisticsRestorer.



10
11
12
13
# File 'lib/gitlab/import_export/statistics_restorer.rb', line 10

def initialize(project:, shared:)
  @project = project
  @shared = shared
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



8
9
10
# File 'lib/gitlab/import_export/statistics_restorer.rb', line 8

def project
  @project
end

Instance Method Details

#restoreObject



15
16
17
18
19
20
21
22
# File 'lib/gitlab/import_export/statistics_restorer.rb', line 15

def restore
  with_progress_tracking(**progress_tracking_options) do
    @project.statistics.refresh!
  end
rescue StandardError => e
  @shared.error(e)
  false
end