aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/threaded_connections_test.rb
diff options
context:
space:
mode:
authorNick <nick@nicksieger.com>2008-04-19 12:42:43 -0500
committerNick Sieger <nick@nicksieger.com>2008-08-29 14:12:09 -0500
commit50cd4bdc99ebaf3ac879e4e7fea43c5b55ca5f68 (patch)
tree3a52394e0e0843826bf3f07b30a5a22b2593b6bf /activerecord/test/cases/threaded_connections_test.rb
parentb185d157fe5c14ecac348558d0c0b42658de7097 (diff)
downloadrails-50cd4bdc99ebaf3ac879e4e7fea43c5b55ca5f68.tar.gz
rails-50cd4bdc99ebaf3ac879e4e7fea43c5b55ca5f68.tar.bz2
rails-50cd4bdc99ebaf3ac879e4e7fea43c5b55ca5f68.zip
Introduce synchronization around connection pool access
- use new active support Module#synchronize - allow_concurrency now switches between a null monitor and a regular monitor (defaulting to null monitor to avoid overhead)
Diffstat (limited to 'activerecord/test/cases/threaded_connections_test.rb')
-rw-r--r--activerecord/test/cases/threaded_connections_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/threaded_connections_test.rb b/activerecord/test/cases/threaded_connections_test.rb
index 9bf7217958..3f88f79189 100644
--- a/activerecord/test/cases/threaded_connections_test.rb
+++ b/activerecord/test/cases/threaded_connections_test.rb
@@ -11,11 +11,15 @@ unless %w(FrontBase).include? ActiveRecord::Base.connection.adapter_name
def setup
@connection = ActiveRecord::Base.remove_connection
@connections = []
+ @allow_concurrency = ActiveRecord::Base.allow_concurrency
+ ActiveRecord::Base.allow_concurrency = true
end
def teardown
# clear the connection cache
ActiveRecord::Base.clear_active_connections!
+ # set allow_concurrency to saved value
+ ActiveRecord::Base.allow_concurrency = @allow_concurrency
# reestablish old connection
ActiveRecord::Base.establish_connection(@connection)
end