まず thread safe にする設定は config/environments/production.rb にある
# Enable threaded mode
# config.threadsafe!
からなので,これを調べると railties/lib/initializer.rb の
def threadsafe!
self.cache_classes = true
self.dependency_loading = false
self.action_controller.allow_concurrency = true
self
end
なので,actionpack/lib/action_controller/base.rb を見ると
@@allow_concurrency = false
cattr_accessor :allow_concurrency
とあるだけ.ならばと rak ‘allow_concurrency’ とかやってみると
activerecord/test/cases/pooled_connections_test.rb
79| def test_allow_concurrency_is_deprecated
80| assert_deprecated('ActiveRecord::Base.allow_concurrency') do
81| ActiveRecord::Base.allow_concurrency
83| assert_deprecated('ActiveRecord::Base.allow_concurrency=') do
84| ActiveRecord::Base.allow_concurrency = true
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
181| # * <tt>:allow_concurrency</tt> - If true, use async query methods so Ruby threads don't deadlock; otherwise, use blocking query methods.
935| @async = @config[:allow_concurrency] && @connection.respond_to?(:async_exec)
activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
90| def allow_concurrency
91| ActiveSupport::Deprecation.warn("ActiveRecord::Base.allow_concurrency has been deprecated and no longer has any effect. Please remove all references to allow_concurrency.")
95| def allow_concurrency=(flag)
96| ActiveSupport::Deprecation.warn("ActiveRecord::Base.allow_concurrency= has been deprecated and no longer has any effect. Please remove all references to allow_concurrency=.")
activerecord/lib/active_record/test_case.rb
48| setup :connection_allow_concurrency_setup
49| teardown :connection_allow_concurrency_teardown
52| def connection_allow_concurrency_setup
54| ActiveRecord::Base.establish_connection(@connection.merge({:allow_concurrency => true}))
57| def connection_allow_concurrency_teardown
actionpack/lib/action_controller/dispatcher.rb
116| if ActionController::Base.allow_concurrency
actionpack/lib/action_controller/base.rb
290| @@allow_concurrency = false
291| cattr_accessor :allow_concurrency
railties/doc/guides/source/2_2_release_notes.txt
408|* +ActiveRecord::Base.allow_concurrency+ no longer has any effect.
railties/doc/guides/html/2_2_release_notes.html
1098|<tt>ActiveRecord::Base.allow_concurrency</tt> no longer has any effect.
railties/lib/webrick_server.rb
43|# can change this behavior by setting ActionController::Base.allow_concurrency
railties/lib/initializer.rb
790| self.action_controller.allow_concurrency = true
と言うことは,
- actionpack/lib/action_controller/dispatcher.rb
- activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
このあたりが怪しいので,次はここを見てみよう.続くかも.
comments powered by Disqus