blob: 31e2798c36b17d3f96ba7c778b343723d6b745ef (
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
|
class RepositoryImportWorker
include ApplicationWorker
include ExceptionBacktrace
include ProjectStartImport
include ProjectImportOptions
def perform(project_id)
project = Project.find(project_id)
return unless start_import(project)
Gitlab::Metrics.add_event(:import_repository,
import_url: project.import_url,
path: project.full_path)
service = Projects::ImportService.new(project, project.creator)
result = service.execute
# Some importers may perform their work asynchronously. In this case it's up
# to those importers to mark the import process as complete.
return if service.async?
raise result[:message] if result[:status] == :error
project.after_import
end
private
def start_import(project)
return true if start(project)
Rails.logger.info("Project #{project.full_path} was in inconsistent state (#{project.import_status}) while importing.")
false
end
end
|