Commit 9ed48a38 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'sh-fix-excessive-project-mirror-gc' into 'master'

Reduce excessive GC on pull mirrors

Closes gitaly#1686

See merge request gitlab-org/gitlab!17931
parents 58cfe223 a2578194
......@@ -9,9 +9,16 @@ module Projects
end
def execute
Projects::HousekeepingService.new(@project).execute do
service = Projects::HousekeepingService.new(@project)
service.execute do
repository.delete_all_refs_except(RESERVED_REF_PREFIXES)
end
# Right now we don't actually have a way to know if a project
# import actually changed, so we increment the counter to avoid
# causing GC to run every time.
service.increment!
rescue Projects::HousekeepingService::LeaseTaken => e
Rails.logger.info( # rubocop:disable Gitlab/RailsLogger
"Could not perform housekeeping for project #{@project.full_path} (#{@project.id}): #{e}")
......
---
title: Reduce excessive GC on pull mirrors
merge_request: 17931
author:
type: performance
......@@ -19,6 +19,8 @@ describe Projects::AfterImportService do
allow(housekeeping_service)
.to receive(:execute).and_yield
expect(housekeeping_service).to receive(:increment!)
end
it 'performs housekeeping' 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