aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_pool_test.rb
diff options
context:
space:
mode:
authorCharles Oliver Nutter <headius@headius.com>2016-11-04 14:00:02 -0500
committerCharles Oliver Nutter <headius@headius.com>2016-11-04 14:00:02 -0500
commit2646c1021adb181b96395afc92b143e115ff113f (patch)
tree3c3f7d8b40da63d38ca8c000f2471677ca46752c /activerecord/test/cases/connection_pool_test.rb
parent98faa2a6a12e849119b60c72b08a25b03d3c867c (diff)
downloadrails-2646c1021adb181b96395afc92b143e115ff113f.tar.gz
rails-2646c1021adb181b96395afc92b143e115ff113f.tar.bz2
rails-2646c1021adb181b96395afc92b143e115ff113f.zip
Use different name for main and thread connection variable.
Under JRuby, the updates of the one shared variable interleaved, causing threads to pick up each others' connections. I'm amazed this worked on MRI.
Diffstat (limited to 'activerecord/test/cases/connection_pool_test.rb')
-rw-r--r--activerecord/test/cases/connection_pool_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb
index d7ff9d6880..3844f1eca2 100644
--- a/activerecord/test/cases/connection_pool_test.rb
+++ b/activerecord/test/cases/connection_pool_test.rb
@@ -184,14 +184,14 @@ module ActiveRecord
def test_checkout_behaviour
pool = ConnectionPool.new ActiveRecord::Base.connection_pool.spec
- connection = pool.connection
- assert_not_nil connection
+ main_connection = pool.connection
+ assert_not_nil main_connection
threads = []
4.times do |i|
threads << Thread.new(i) do
- connection = pool.connection
- assert_not_nil connection
- connection.close
+ thread_connection = pool.connection
+ assert_not_nil thread_connection
+ thread_connection.close
end
end