summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBastian Blank <waldi@debian.org>2018-02-05 17:36:51 +0000
committerBastian Blank <waldi@debian.org>2018-02-06 16:36:35 +0000
commit285d5d526b1d568580b63488b8832cfc9ef19077 (patch)
tree9587cbbed938bacc92df4272fe3329e703c223a1 /app
parent1214d8de691494138cbaab10da242c71504158de (diff)
downloadgitlab-ce-285d5d526b1d568580b63488b8832cfc9ef19077.tar.gz
Close low level rugged repository in project cache worker
Signed-off-by: Bastian Blank <waldi@debian.org>
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb5
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/workers/project_cache_worker.rb2
3 files changed, 10 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 12d5f28f5ea..33085151217 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -511,10 +511,13 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(full_path, self, disk_path: disk_path)
end
- def reload_repository!
+ def cleanup
+ @repository&.cleanup
@repository = nil
end
+ alias_method :reload_repository!, :cleanup
+
def container_registry_url
if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{full_path.downcase}"
diff --git a/app/models/repository.rb b/app/models/repository.rb
index f1abe5c3e07..3d6f8f0c305 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -93,6 +93,10 @@ class Repository
alias_method :raw, :raw_repository
+ def cleanup
+ @raw_repository&.cleanup
+ end
+
# Return absolute path to repository
def path_to_repo
@path_to_repo ||= File.expand_path(
diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb
index f19bcbf946a..a993b4b2680 100644
--- a/app/workers/project_cache_worker.rb
+++ b/app/workers/project_cache_worker.rb
@@ -18,6 +18,8 @@ class ProjectCacheWorker
update_statistics(project, statistics.map(&:to_sym))
project.repository.refresh_method_caches(files.map(&:to_sym))
+
+ project.cleanup
end
def update_statistics(project, statistics = [])