aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/load_interlock.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-09-30 01:32:42 +0930
committerMatthew Draper <matthew@trebex.net>2015-07-09 02:23:23 +0930
commitc37d47e30897762145835e66ae752cce924af01d (patch)
tree1b615adf6030b9d77557c88a51497c432a2c58a8 /actionpack/lib/action_dispatch/middleware/load_interlock.rb
parentc2b5aa041b04e65475dd3ebb9f33a68b26e25895 (diff)
downloadrails-c37d47e30897762145835e66ae752cce924af01d.tar.gz
rails-c37d47e30897762145835e66ae752cce924af01d.tar.bz2
rails-c37d47e30897762145835e66ae752cce924af01d.zip
Soften the lock requirements when eager_load is disabled
We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/load_interlock.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/load_interlock.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/load_interlock.rb b/actionpack/lib/action_dispatch/middleware/load_interlock.rb
new file mode 100644
index 0000000000..cbe8d750fe
--- /dev/null
+++ b/actionpack/lib/action_dispatch/middleware/load_interlock.rb
@@ -0,0 +1,12 @@
+require 'active_support/dependencies'
+require 'rack/lock'
+
+module ActionDispatch
+ class LoadInterlock < ::Rack::Lock
+ FLAG = 'activesupport.dependency_race'.freeze
+
+ def initialize(app, mutex = ::ActiveSupport::Dependencies.interlock)
+ super
+ end
+ end
+end