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
Jérome Perrin
gitlab-ce
Commits
f49868ad
Commit
f49868ad
authored
Mar 13, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'backport-cache-middleware-fix' into 'master'
Backport cache middleware fix See merge request !9867
parents
31b6ca50
22ff9b78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
config/initializers/fix_local_cache_middleware.rb
config/initializers/fix_local_cache_middleware.rb
+24
-0
No files found.
config/initializers/fix_local_cache_middleware.rb
0 → 100644
View file @
f49868ad
module
LocalCacheRegistryCleanupWithEnsure
LocalCacheRegistry
=
ActiveSupport
::
Cache
::
Strategy
::
LocalCache
::
LocalCacheRegistry
LocalStore
=
ActiveSupport
::
Cache
::
Strategy
::
LocalCache
::
LocalStore
def
call
(
env
)
LocalCacheRegistry
.
set_cache_for
(
local_cache_key
,
LocalStore
.
new
)
response
=
@app
.
call
(
env
)
response
[
2
]
=
::
Rack
::
BodyProxy
.
new
(
response
[
2
])
do
LocalCacheRegistry
.
set_cache_for
(
local_cache_key
,
nil
)
end
cleanup_after_response
=
true
# ADDED THIS LINE
response
rescue
Rack
::
Utils
::
InvalidParameterError
[
400
,
{},
[]]
ensure
# ADDED ensure CLAUSE to cleanup when something is thrown
LocalCacheRegistry
.
set_cache_for
(
local_cache_key
,
nil
)
unless
cleanup_after_response
end
end
ActiveSupport
::
Cache
::
Strategy
::
LocalCache
::
Middleware
.
prepend
(
LocalCacheRegistryCleanupWithEnsure
)
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