Permalink
Browse files

synchronize on param filter cache.

Do we actually need this cache?
  • Loading branch information...
tenderlove committed Oct 19, 2012
1 parent 8654f8c commit 0d7b0f0183ce9f1bfc524cf6afd5d7de852ebc76
Showing with 7 additions and 2 deletions.
  1. +7 −2 actionpack/lib/action_dispatch/http/filter_parameters.rb
@@ -1,3 +1,4 @@
+require 'mutex_m'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/object/duplicable'
@@ -20,7 +21,7 @@ module Http
# end
# => reverses the value to all keys matching /secret/i
module FilterParameters
- @@parameter_filter_for = {}
+ @@parameter_filter_for = {}.extend(Mutex_m)
ENV_MATCH = [/RAW_POST_DATA/, "rack.request.form_vars"] # :nodoc:
NULL_PARAM_FILTER = ParameterFilter.new # :nodoc:
@@ -64,7 +65,11 @@ def env_filter
end
def parameter_filter_for(filters)
- @@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
+ @@parameter_filter_for.synchronize do
+ # Do we *actually* need this cache? Constructing ParameterFilters
+ # doesn't seem too expensive.
+ @@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
+ end
end
KV_RE = '[^&;=]+'

2 comments on commit 0d7b0f0

Owner

rafaelfranca replied Oct 19, 2012

I don't think we need this cache. Can you check with the author?

Owner

tenderlove replied Oct 19, 2012

Looks like @josevalim added the cache in 55ae903. @josevalim do we really need this?

Please sign in to comment.