2016-07-08 15:32:58 -04:00
|
|
|
class GitGarbageCollectWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
include Gitlab::ShellAdapter
|
|
|
|
|
|
|
|
sidekiq_options queue: :gitlab_shell, retry: false
|
|
|
|
|
|
|
|
def perform(project_id)
|
|
|
|
project = Project.find(project_id)
|
|
|
|
|
|
|
|
gitlab_shell.gc(project.repository_storage_path, project.path_with_namespace)
|
2016-07-13 09:41:06 -04:00
|
|
|
# Refresh the branch cache in case garbage collection caused a ref lookup to fail
|
2016-07-08 15:32:58 -04:00
|
|
|
project.repository.after_create_branch
|
2016-07-13 09:41:06 -04:00
|
|
|
project.repository.branch_names
|
|
|
|
project.repository.has_visible_content?
|
2016-07-08 15:32:58 -04:00
|
|
|
end
|
|
|
|
end
|