diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application/default_middleware_stack.rb | 22 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 6 |
2 files changed, 11 insertions, 17 deletions
diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index 14ea073039..88eade5c5a 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -32,26 +32,18 @@ module Rails middleware.use ::Rack::Lock - elsif config.allow_concurrency - # Do nothing, even if we know this is dangerous + 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 + # Default concurrency setting: enabled, but safe - if config.cache_classes && config.eager_load - # No lock required - - elsif config.cache_classes - # The load interlock is required, but not a full request - # lock + unless config.cache_classes && config.eager_load + # Without cache_classes + eager_load, the load interlock + # is required for proper operation middleware.use ::ActionDispatch::LoadInterlock - - else - # If we're reloading on each request, they all need to be - # run in isolation - - middleware.use ::Rack::Lock end end diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 0599e988d9..f8f92792a7 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -86,8 +86,10 @@ module Rails # added in the hook are taken into account. initializer :set_clear_dependencies_hook, group: :all do callback = lambda do - ActiveSupport::DescendantsTracker.clear - ActiveSupport::Dependencies.clear + ActiveSupport::Dependencies.interlock.attempt_loading do + ActiveSupport::DescendantsTracker.clear + ActiveSupport::Dependencies.clear + end end if config.reload_classes_only_on_change |