Permalink
Browse files

Merge pull request #33 from github/dont-reload-middleware-stack-every…

…-request

Don't reload middleware stack every request
  • Loading branch information...
2 parents e5bebc0 + f699184 commit fed4fafa8af5ac1ea7808d23839c0eeb4fc69deb @charliesome charliesome committed Dec 30, 2013
Showing with 2 additions and 7 deletions.
  1. +1 −6 actionpack/lib/action_controller/dispatcher.rb
  2. +1 −1 actionpack/test/controller/dispatcher_test.rb
@@ -78,7 +78,7 @@ def cleanup_application
# DEPRECATE: Remove arguments, since they are only used by CGI
def initialize(output = $stdout, request = nil, response = nil)
@output = output
- build_middleware_stack if @@cache_classes
+ build_middleware_stack
end
def dispatch
@@ -106,11 +106,6 @@ def call(env)
@app.call(env)
else
Reloader.run do
- # When class reloading is turned on, we will want to rebuild the
- # middleware stack every time we process a request. If we don't
- # rebuild the middleware stack, then the stack may contain references
- # to old classes metal classes, which will b0rk class reloading.
- build_middleware_stack
@app.call(env)
end
end
@@ -45,7 +45,7 @@ def test_builds_middleware_stack_only_during_initialization_if_not_in_loading_mo
def test_rebuilds_middleware_stack_on_every_request_if_in_loading_mode
dispatcher = create_dispatcher(false)
dispatcher.instance_variable_set(:"@app", lambda { |env| })
- dispatcher.expects(:build_middleware_stack).twice
+ dispatcher.expects(:build_middleware_stack).never
dispatcher.call(nil)
Reloader.default_lock.unlock
dispatcher.call(nil)

0 comments on commit fed4faf

Please sign in to comment.