Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-01-30 16:52:12 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-01-30 17:16:56 +0300
commit55995827f1b9ebf7066772071db3f02d8ed63312 (patch)
tree5e1ceb38b615634fd153c240c7fbc0bd8a160d97
parent29c1fd8b55f07003054ae0098faa4b2987a3a407 (diff)
Use weakref to make sure not holding the project42572-close-repo-after-request
-rw-r--r--app/controllers/application_controller.rb10
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