Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
885998c2
Commit
885998c2
authored
Mar 03, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Release libgit2 cache and open file descriptors after `git gc` run
Relates to #21879
parent
8a0052c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
app/workers/git_garbage_collect_worker.rb
app/workers/git_garbage_collect_worker.rb
+4
-0
changelogs/unreleased/sh-cleanup-after-git-gc.yml
changelogs/unreleased/sh-cleanup-after-git-gc.yml
+5
-0
spec/workers/git_garbage_collect_worker_spec.rb
spec/workers/git_garbage_collect_worker_spec.rb
+6
-0
No files found.
app/workers/git_garbage_collect_worker.rb
View file @
885998c2
...
...
@@ -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
...
...
changelogs/unreleased/sh-cleanup-after-git-gc.yml
0 → 100644
View file @
885998c2
---
title
:
Release libgit2 cache and open file descriptors after `git gc` run
merge_request
:
author
:
type
:
fixed
spec/workers/git_garbage_collect_worker_spec.rb
View file @
885998c2
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment