mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
This keeps all the cache expiration code in a single file/class instead of spreading it all across the codebase.
25 lines
551 B
Ruby
25 lines
551 B
Ruby
class RepositoryImportWorker
|
|
include Sidekiq::Worker
|
|
include Gitlab::ShellAdapter
|
|
|
|
sidekiq_options queue: :gitlab_shell
|
|
|
|
attr_accessor :project, :current_user
|
|
|
|
def perform(project_id)
|
|
@project = Project.find(project_id)
|
|
@current_user = @project.creator
|
|
|
|
result = Projects::ImportService.new(project, current_user).execute
|
|
|
|
if result[:status] == :error
|
|
project.update(import_error: result[:message])
|
|
project.import_fail
|
|
return
|
|
end
|
|
|
|
project.repository.after_import
|
|
project.import_finish
|
|
end
|
|
end
|