gitlab-org--gitlab-foss/app/workers/git_garbage_collect_worker.rb
Stan Hu 3dc6bf2b71 Expire the branch cache after git gc runs
Due to a stale NFS cache, it's possible that a branch lookup fails
while `git gc` is running and causes missing branches in merge requests.

Possible workaround for #15392
2016-07-12 05:42:19 -07:00

14 lines
428 B
Ruby

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)
# Expire the branch cache in case garbage collection caused a ref lookup to fail
project.repository.after_create_branch
end
end