Free open file descriptors and libgit2 buffers in UpdatePagesService
In UpdatePagesService, we were seeing a large number of open pack files in production. Calling Project#cleanup removes a reference to Rugged::Repository and forces libgit2 to close file descriptors and free its internal memory cache. Relates to https://gitlab.com/gitlab-com/infrastructure/issues/3965#note_65837525
This commit is contained in:
parent
9b76d8512a
commit
cc82abbde0
2 changed files with 8 additions and 0 deletions
|
@ -178,6 +178,9 @@ module Projects
|
|||
|
||||
def latest_sha
|
||||
project.commit(build.ref).try(:sha).to_s
|
||||
ensure
|
||||
# Close any file descriptors that were opened and free libgit2 buffers
|
||||
project.cleanup
|
||||
end
|
||||
|
||||
def sha
|
||||
|
|
5
changelogs/unreleased/sh-cleanup-pages-worker.yml
Normal file
5
changelogs/unreleased/sh-cleanup-pages-worker.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Free open file descriptors and libgit2 buffers in UpdatePagesService
|
||||
merge_request:
|
||||
author:
|
||||
type: performance
|
Loading…
Reference in a new issue