BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
config.ru
config.ru
+1
-1
release_env.rb
lib/gitlab/middleware/release_env.rb
+7
-2
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
→
lib/gitlab/middleware/release_
env
.rb
View file @
31f1ec59
module
Gitlab
module
Middleware
ReleaseController
=
Struct
.
new
(
:app
)
do
# 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
.
delete
(
'action_controller.instance'
)
}
app
.
call
(
env
).
tap
{
env
.
clear
}
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