Permalink
Browse files

Make Rack::Cache multithread friendly

  • Loading branch information...
1 parent 687f8b8 commit 40a7c50e76c9b2939b8258312dd9155da74aaf00 @jtblin committed Aug 4, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/rack/cache/context.rb
  2. +1 −0 test/spec_setup.rb
View
2 lib/rack/cache/context.rb
@@ -45,7 +45,7 @@ def entitystore
# each request in a dup object unless the +rack.run_once+ variable is
# set in the environment.
def call(env)
- if env['rack.run_once']
+ if env['rack.run_once'] && !env['rack.multithread']
call! env
else
clone.call! env
View
1 test/spec_setup.rb
@@ -149,6 +149,7 @@ def cache_config(&block)
def request(method, uri='/', opts={})
opts = {
'rack.run_once' => true,
+ 'rack.multithread' => false,
'rack.errors' => @errors,
'rack-cache.storage' => @storage
}.merge(opts)

0 comments on commit 40a7c50

Please sign in to comment.