BigW Consortium Gitlab

Commit 62d6f1ed by Robert Speicher

Merge branch 'sh-cleanup-after-git-gc' into 'master'

Release libgit2 cache and open file descriptors after `git gc` run See merge request gitlab-org/gitlab-ce!17506
parents 6fdc09c7 885998c2
...@@ -44,6 +44,10 @@ class GitGarbageCollectWorker ...@@ -44,6 +44,10 @@ class GitGarbageCollectWorker
# Refresh the branch cache in case garbage collection caused a ref lookup to fail # Refresh the branch cache in case garbage collection caused a ref lookup to fail
flush_ref_caches(project) if task == :gc flush_ref_caches(project) if task == :gc
# In case pack files are deleted, release libgit2 cache and open file
# descriptors ASAP instead of waiting for Ruby garbage collection
project.cleanup
ensure ensure
cancel_lease(lease_key, lease_uuid) if lease_key.present? && lease_uuid.present? cancel_lease(lease_key, lease_uuid) if lease_key.present? && lease_uuid.present?
end end
......
---
title: Release libgit2 cache and open file descriptors after `git gc` run
merge_request:
author:
type: fixed
...@@ -195,6 +195,12 @@ describe GitGarbageCollectWorker do ...@@ -195,6 +195,12 @@ describe GitGarbageCollectWorker do
expect(File.exist?(bitmap_path(after_packs.first))).to eq(bitmaps_enabled) expect(File.exist?(bitmap_path(after_packs.first))).to eq(bitmaps_enabled)
end end
it 'cleans up repository after finishing' do
expect_any_instance_of(Project).to receive(:cleanup).and_call_original
subject.perform(project.id, 'gc', lease_key, lease_uuid)
end
end end
context 'with bitmaps enabled' do context 'with bitmaps enabled' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment