Class: Gitlab::GithubImport::Importer::LfsObjectImporter
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Importer::LfsObjectImporter
- Defined in:
- lib/gitlab/github_import/importer/lfs_object_importer.rb
Constant Summary collapse
- RETRY_DELAY =
120
Instance Attribute Summary collapse
-
#lfs_object ⇒ Object
readonly
Returns the value of attribute lfs_object.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(lfs_object, project, _) ⇒ LfsObjectImporter
constructor
lfs_object - An instance of
Gitlab::GithubImport::Representation::LfsObject. - #lfs_download_object ⇒ Object
Constructor Details
#initialize(lfs_object, project, _) ⇒ LfsObjectImporter
lfs_object - An instance of Gitlab::GithubImport::Representation::LfsObject. project - An instance of Project.
13 14 15 16 |
# File 'lib/gitlab/github_import/importer/lfs_object_importer.rb', line 13 def initialize(lfs_object, project, _) @lfs_object = lfs_object @project = project end |
Instance Attribute Details
#lfs_object ⇒ Object (readonly)
Returns the value of attribute lfs_object.
7 8 9 |
# File 'lib/gitlab/github_import/importer/lfs_object_importer.rb', line 7 def lfs_object @lfs_object end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'lib/gitlab/github_import/importer/lfs_object_importer.rb', line 7 def project @project end |
Instance Method Details
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/gitlab/github_import/importer/lfs_object_importer.rb', line 23 def execute result = Projects::LfsPointers::LfsDownloadService.new(project, lfs_download_object).execute if result[:status] == :error && result[:message]&.include?('Received error code 429') raise Gitlab::GithubImport::RateLimitError.new('Rate Limit exceeded', RETRY_DELAY) end result end |
#lfs_download_object ⇒ Object
18 19 20 21 |
# File 'lib/gitlab/github_import/importer/lfs_object_importer.rb', line 18 def lfs_download_object LfsDownloadObject.new(oid: lfs_object.oid, size: lfs_object.size, link: lfs_object.link, headers: lfs_object.headers) end |