Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lfs_objects_importer.rb « importer « github_import « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 775afd5f53a3b308cd6082b5b5dfc787bed580d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

module Gitlab
  module GithubImport
    module Importer
      class LfsObjectsImporter
        include ParallelScheduling

        def importer_class
          LfsObjectImporter
        end

        def representation_class
          Representation::LfsObject
        end

        def sidekiq_worker_class
          ImportLfsObjectWorker
        end

        def object_type
          :lfs_object
        end

        def collection_method
          :lfs_objects
        end

        def each_object_to_import
          lfs_objects = Projects::LfsPointers::LfsObjectDownloadListService.new(project).execute

          lfs_objects.each do |object|
            Gitlab::GithubImport::ObjectCounter.increment(project, object_type, :fetched)

            yield object
          end
        rescue StandardError => e
          Gitlab::Import::ImportFailureService.track(
            project_id: project.id,
            error_source: importer_class.name,
            exception: e
          )
        end
      end
    end
  end
end