Files
gitlab-foss/lib/gitlab/import_export/statistics_restorer.rb
2025-03-05 12:12:17 +00:00

37 lines
697 B
Ruby

# frozen_string_literal: true
module Gitlab
module ImportExport
class StatisticsRestorer
include ::Import::Framework::ProgressTracking
attr_reader :project
def initialize(project:, shared:)
@project = project
@shared = shared
end
def restore
with_progress_tracking(**progress_tracking_options) do
@project.statistics.refresh!
end
rescue StandardError => e
@shared.error(e)
false
end
private
def progress_tracking_options
{
scope: {
project_id: project.id
},
data: 'statistics_refresh'
}
end
end
end
end