debian-mirror-gitlab/app/workers/git_garbage_collect_worker.rb

18 lines
519 B
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
class GitGarbageCollectWorker
include Sidekiq::Worker
include Gitlab::ShellAdapter
2016-11-03 12:29:30 +05:30
include DedicatedSidekiqQueue
2016-08-24 12:49:21 +05:30
2016-11-03 12:29:30 +05:30
sidekiq_options retry: false
2016-08-24 12:49:21 +05:30
def perform(project_id)
project = Project.find(project_id)
gitlab_shell.gc(project.repository_storage_path, project.path_with_namespace)
# Refresh the branch cache in case garbage collection caused a ref lookup to fail
project.repository.after_create_branch
project.repository.branch_names
project.repository.has_visible_content?
end
end