Skip to content
Snippets Groups Projects
Commit ccc01b36 authored by Douwe Maan's avatar Douwe Maan
Browse files

Small code cleanup.

parent e7bbd85b
No related branches found
No related tags found
1 merge request!436Archive repositories in background worker.
Loading
Loading
@@ -3,7 +3,7 @@ class ArchiveRepositoryService
 
def initialize(project, ref, format)
format ||= 'tar.gz'
@project, @ref, @format = project, ref, format
@project, @ref, @format = project, ref, format.downcase
end
 
def execute
Loading
Loading
@@ -28,16 +28,12 @@ class ArchiveRepositoryService
Gitlab.config.gitlab.repository_downloads_path
end
 
def archive_args
@archive_args ||= [ref, storage_path, format.downcase]
end
def file_path
@file_path ||= project.repository.archive_file_path(*archive_args)
@file_path ||= project.repository.archive_file_path(ref, storage_path, format)
end
 
def pid_file_path
@pid_file_path ||= project.repository.archive_pid_file_path(*archive_args)
@pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format)
end
 
def archived?
Loading
Loading
@@ -48,8 +44,7 @@ class ArchiveRepositoryService
File.exist?(pid_file_path)
end
 
def wait_until_archived
timeout = 5.0
def wait_until_archived(timeout = 5.0)
t1 = Time.now
 
begin
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ class RepositoryArchiveWorker
 
def perform(project_id, ref, format)
@project = Project.find(project_id)
@ref, @format = ref, format
@ref, @format = ref, format.downcase
 
repository = project.repository
 
Loading
Loading
@@ -15,7 +15,7 @@ class RepositoryArchiveWorker
 
return if archived? || archiving?
 
repository.archive_repo(*archive_args)
repository.archive_repo(ref, storage_path, format)
end
 
private
Loading
Loading
@@ -24,16 +24,12 @@ class RepositoryArchiveWorker
Gitlab.config.gitlab.repository_downloads_path
end
 
def archive_args
@archive_args ||= [ref, storage_path, format.downcase]
end
def file_path
@file_path ||= project.repository.archive_file_path(*archive_args)
@file_path ||= project.repository.archive_file_path(ref, storage_path, format)
end
 
def pid_file_path
@pid_file_path ||= project.repository.archive_pid_file_path(*archive_args)
@pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format)
end
 
def archived?
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment