Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
31f1ec59
Commit
31f1ec59
authored
Feb 07, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Release the entire env
parent
bbfce29b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
11 deletions
+16
-11
config.ru
config.ru
+1
-1
lib/gitlab/middleware/release_controller.rb
lib/gitlab/middleware/release_controller.rb
+0
-9
lib/gitlab/middleware/release_env.rb
lib/gitlab/middleware/release_env.rb
+14
-0
spec/lib/gitlab/middleware/release_env_spec.rb
spec/lib/gitlab/middleware/release_env_spec.rb
+1
-1
No files found.
config.ru
View file @
31f1ec59
...
...
@@ -23,6 +23,6 @@ warmup do |app|
end
map
ENV
[
'RAILS_RELATIVE_URL_ROOT'
]
||
"/"
do
use
Gitlab
::
ReleaseController
use
Gitlab
::
Middleware
::
ReleaseEnv
run
Gitlab
::
Application
end
lib/gitlab/middleware/release_controller.rb
deleted
100644 → 0
View file @
bbfce29b
module
Gitlab
module
Middleware
ReleaseController
=
Struct
.
new
(
:app
)
do
def
call
(
env
)
app
.
call
(
env
).
tap
{
env
.
delete
(
'action_controller.instance'
)
}
end
end
end
end
lib/gitlab/middleware/release_env.rb
0 → 100644
View file @
31f1ec59
module
Gitlab
module
Middleware
# Some of middleware would hold env for no good reason even after the
# request had already been processed, and we could not garbage collect
# them due to this. Put this middleware as the first middleware so that
# it would clear the env after the request is done, allowing GC gets a
# chance to release memory for the last request.
ReleaseEnv
=
Struct
.
new
(
:app
)
do
def
call
(
env
)
app
.
call
(
env
).
tap
{
env
.
clear
}
end
end
end
end
spec/lib/gitlab/middleware/release_
controller
_spec.rb
→
spec/lib/gitlab/middleware/release_
env
_spec.rb
View file @
31f1ec59
require
'spec_helper'
describe
Gitlab
::
Middleware
::
Release
Controller
do
describe
Gitlab
::
Middleware
::
Release
Env
do
let
(
:inner_app
)
{
double
(
:app
)
}
let
(
:app
)
{
described_class
.
new
(
inner_app
)
}
let
(
:env
)
{
{
'action_controller.instance'
=>
'something'
}
}
...
...
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