Remove CachedConnectionPerThread per-thread pooling mechanism in favor of a fixed pool with default maximum of 5 connections

This commit is contained in:
Nick Sieger
2008-08-22 13:45:10 -05:00
parent ca6d71753f
commit 212134dce1
6 changed files with 17 additions and 18 deletions

View File

@@ -280,6 +280,7 @@ unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :OpenBaseAdapter)
sleep zzz # block thread 2 for zzz seconds
end
t1 = Time.now
Person.clear_active_connections!
end
b = Thread.new do
@@ -287,6 +288,7 @@ unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :OpenBaseAdapter)
t2 = Time.now
Person.transaction { yield }
t3 = Time.now
Person.clear_active_connections!
end
a.join

View File

@@ -16,12 +16,14 @@ unless %w(FrontBase).include? ActiveRecord::Base.connection.adapter_name
class PooledConnectionsTest < ActiveRecord::TestCase
def setup
super
@connection = ActiveRecord::Base.remove_connection
end
def teardown
ActiveRecord::Base.clear_all_connections!
ActiveRecord::Base.establish_connection(@connection)
super
end
def checkout_connections

View File

@@ -296,6 +296,7 @@ if current_adapter?(:PostgreSQLAdapter)
topic.approved = !topic.approved?
topic.save!
end
Topic.clear_active_connections!
end
end
@@ -331,6 +332,7 @@ if current_adapter?(:PostgreSQLAdapter)
dev = Developer.find(1)
assert_equal original_salary, dev.salary
end
Developer.clear_active_connections!
end
end
@@ -342,6 +344,7 @@ if current_adapter?(:PostgreSQLAdapter)
# Always expect original salary.
assert_equal original_salary, Developer.find(1).salary
end
Developer.clear_active_connections!
end
end