Release libgit2 cache and open file descriptors after git gc
run
Relates to #21879
This commit is contained in:
parent
8a0052c037
commit
885998c220
3 changed files with 15 additions and 0 deletions
|
@ -44,6 +44,10 @@ class GitGarbageCollectWorker
|
|||
|
||||
# Refresh the branch cache in case garbage collection caused a ref lookup to fail
|
||||
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
|
||||
cancel_lease(lease_key, lease_uuid) if lease_key.present? && lease_uuid.present?
|
||||
end
|
||||
|
|
5
changelogs/unreleased/sh-cleanup-after-git-gc.yml
Normal file
5
changelogs/unreleased/sh-cleanup-after-git-gc.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Release libgit2 cache and open file descriptors after `git gc` run
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -195,6 +195,12 @@ describe GitGarbageCollectWorker do
|
|||
|
||||
expect(File.exist?(bitmap_path(after_packs.first))).to eq(bitmaps_enabled)
|
||||
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
|
||||
|
||||
context 'with bitmaps enabled' do
|
||||
|
|
Loading…
Reference in a new issue