summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-05-02 21:41:05 +0000
committerStan Hu <stanhu@gmail.com>2019-05-02 21:41:05 +0000
commitd25239ee0b56a1f7c00d805949d0d0009037ee54 (patch)
tree1fd3e06bfed0744e4b33f211821abf221763f516 /app/services
parent8163e233252f4335d8b2ccb11ced51a77944ee4d (diff)
downloadgitlab-ce-d25239ee0b56a1f7c00d805949d0d0009037ee54.tar.gz
Use git_garbage_collect_worker to run pack_refs
PackRefs is not an expensive gitaly call - we want to call it more often (than as part of full `gc`) because it helps to keep number of refs files small - too many refs file may be a problem for deployments with slow storage.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/projects/housekeeping_service.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb
index 10bd5363b51..9428575591e 100644
--- a/app/services/projects/housekeeping_service.rb
+++ b/app/services/projects/housekeeping_service.rb
@@ -11,6 +11,7 @@ module Projects
class HousekeepingService < BaseService
# Timeout set to 24h
LEASE_TIMEOUT = 86400
+ PACK_REFS_PERIOD = 6
class LeaseTaken < StandardError
def to_s
@@ -76,13 +77,15 @@ module Projects
:gc
elsif pushes_since_gc % full_repack_period == 0
:full_repack
- else
+ elsif pushes_since_gc % repack_period == 0
:incremental_repack
+ else
+ :pack_refs
end
end
def period_match?
- [gc_period, full_repack_period, repack_period].any? { |period| pushes_since_gc % period == 0 }
+ [gc_period, full_repack_period, repack_period, PACK_REFS_PERIOD].any? { |period| pushes_since_gc % period == 0 }
end
def housekeeping_enabled?