Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
55995827
Commit
55995827
authored
7 years ago
by
Lin Jen-Shin
Browse files
Options
Download
Email Patches
Plain Diff
Use weakref to make sure not holding the project
parent
29c1fd8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+8
-2
No files found.
app/controllers/application_controller.rb
View file @
55995827
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment