Commit cc82abbd authored by Stan Hu's avatar Stan Hu

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
parent 9b76d851
......@@ -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
......
---
title: Free open file descriptors and libgit2 buffers in UpdatePagesService
merge_request:
author:
type: performance
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