diff options
Diffstat (limited to 'app/services/projects/housekeeping_service.rb')
-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 |