diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-14 16:49:24 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-14 16:49:24 +0100 |
commit | 021d53c96d308df7c721984435442993357a3414 (patch) | |
tree | 13bd15cb10952efd5c759a5dee5b8de6f243e056 /app/services/projects | |
parent | a02fe251df7ea7316f51850fe603e7e5ac4431e2 (diff) | |
download | gitlab-ce-021d53c96d308df7c721984435442993357a3414.tar.gz |
Run 'git gc' every 10 pushes
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/housekeeping_service.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb index 11be5b1badf..83bdedf7a8d 100644 --- a/app/services/projects/housekeeping_service.rb +++ b/app/services/projects/housekeeping_service.rb @@ -19,9 +19,21 @@ module Projects if !try_obtain_lease return "Housekeeping was already triggered in the past #{LEASE_TIMEOUT / 60} minutes" end - + GitlabShellWorker.perform_async(:gc, @project.path_with_namespace) - return "Housekeeping successfully started" + @project.pushes_since_gc = 0 + @project.save! + + "Housekeeping successfully started" + end + + def needed? + @project.pushes_since_gc >= 10 + end + + def increment! + @project.pushes_since_gc += 1 + @project.save! end private |