BigW Consortium Gitlab

git_garbage_collect_worker.rb 509 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
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)
11
    # Refresh the branch cache in case garbage collection caused a ref lookup to fail
12
    project.repository.after_create_branch
13 14
    project.repository.branch_names
    project.repository.has_visible_content?
15 16
  end
end