diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-01-30 21:52:12 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-30 22:16:56 +0800 |
commit | 55995827f1b9ebf7066772071db3f02d8ed63312 (patch) | |
tree | 5e1ceb38b615634fd153c240c7fbc0bd8a160d97 | |
parent | 29c1fd8b55f07003054ae0098faa4b2987a3a407 (diff) | |
download | gitlab-ce-42572-close-repo-after-request.tar.gz |
Use weakref to make sure not holding the project42572-close-repo-after-request
-rw-r--r-- | app/controllers/application_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c5aed71ad04..87ef80c9b14 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -346,7 +346,13 @@ class ApplicationController < ActionController::Base def close_project_repository return unless @project - project = @project - ObjectSpace.define_finalizer(self, lambda { project.reload_repository! }) + project = WeakRef.new(@project) + ObjectSpace.define_finalizer(self, + lambda do + begin + project.reload_repository! if project.weakref_alive? + rescue WeakRef::RefError + end + end) end end |