diff options
| author | Stan Hu <stanhu@gmail.com> | 2016-07-08 12:32:58 -0700 |
|---|---|---|
| committer | Stan Hu <stanhu@gmail.com> | 2016-07-12 05:42:19 -0700 |
| commit | 3dc6bf2b71f995a3b6ca40ebbf9abb5c11397b8b (patch) | |
| tree | 80fdf211e03d5eb265d68e62a83eb784f150174b /app/workers | |
| parent | 3ca9253444710c6a2d5ad4dca345f8d558be4f1a (diff) | |
| download | gitlab-ce-3dc6bf2b71f995a3b6ca40ebbf9abb5c11397b8b.tar.gz | |
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
Diffstat (limited to 'app/workers')
| -rw-r--r-- | app/workers/git_garbage_collect_worker.rb | 14 | ||||
| -rw-r--r-- | app/workers/gitlab_shell_one_shot_worker.rb | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/app/workers/git_garbage_collect_worker.rb b/app/workers/git_garbage_collect_worker.rb new file mode 100644 index 00000000000..2fa3c838f55 --- /dev/null +++ b/app/workers/git_garbage_collect_worker.rb @@ -0,0 +1,14 @@ +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 diff --git a/app/workers/gitlab_shell_one_shot_worker.rb b/app/workers/gitlab_shell_one_shot_worker.rb deleted file mode 100644 index 4ddbcf574d5..00000000000 --- a/app/workers/gitlab_shell_one_shot_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class GitlabShellOneShotWorker - include Sidekiq::Worker - include Gitlab::ShellAdapter - - sidekiq_options queue: :gitlab_shell, retry: false - - def perform(action, *arg) - gitlab_shell.send(action, *arg) - end -end |
