aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/default_middleware_stack.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-02-22 11:55:52 +1030
committerMatthew Draper <matthew@trebex.net>2016-03-02 02:14:20 +1030
commitd3c9d808e3e242155a44fd2a89ef272cfade8fe8 (patch)
treef24199aec76f44fa8b6536c0664382672ad10e10 /railties/lib/rails/application/default_middleware_stack.rb
parent664a13e6fb8281107da0da75e7cd91bba1425f76 (diff)
downloadrails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.tar.gz
rails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.tar.bz2
rails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.zip
Publish AS::Executor and AS::Reloader APIs
These should allow external code to run blocks of user code to do "work", at a similar unit size to a web request, without needing to get intimate with ActionDipatch.
Diffstat (limited to 'railties/lib/rails/application/default_middleware_stack.rb')
-rw-r--r--railties/lib/rails/application/default_middleware_stack.rb22
1 files changed, 3 insertions, 19 deletions
diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb
index 4f1cc0703d..381e548730 100644
--- a/railties/lib/rails/application/default_middleware_stack.rb
+++ b/railties/lib/rails/application/default_middleware_stack.rb
@@ -34,22 +34,10 @@ module Rails
# handling: presumably their code is not threadsafe
middleware.use ::Rack::Lock
-
- elsif config.allow_concurrency == :unsafe
- # Do nothing, even if we know this is dangerous. This is the
- # historical behaviour for true.
-
- else
- # Default concurrency setting: enabled, but safe
-
- unless config.cache_classes && config.eager_load
- # Without cache_classes + eager_load, the load interlock
- # is required for proper operation
-
- middleware.use ::ActionDispatch::LoadInterlock
- end
end
+ middleware.use ::ActionDispatch::Executor, app.executor
+
middleware.use ::Rack::Runtime
middleware.use ::Rack::MethodOverride unless config.api_only
middleware.use ::ActionDispatch::RequestId
@@ -61,7 +49,7 @@ module Rails
middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies
unless config.cache_classes
- middleware.use ::ActionDispatch::Reloader, lambda { reload_dependencies? }
+ middleware.use ::ActionDispatch::Reloader, app.reloader
end
middleware.use ::ActionDispatch::Callbacks
@@ -83,10 +71,6 @@ module Rails
private
- def reload_dependencies?
- config.reload_classes_only_on_change != true || app.reloaders.map(&:updated?).any?
- end
-
def load_rack_cache
rack_cache = config.action_dispatch.rack_cache
return unless rack_cache