aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_pool_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-11-17 23:48:16 +1030
committerGitHub <noreply@github.com>2017-11-17 23:48:16 +1030
commiteed3d3fff5ca6be00b2fe0fe020bd025ddbabbd5 (patch)
tree35b8ba1dcdc892570575ebe8efbdbc7e6e99b47d /activerecord/test/cases/connection_pool_test.rb
parentcd3c0fa3d04b634e272b4f5b232fdd433b3238f4 (diff)
parent47d678d9b2ab6d3e888691e8327e657ff0b5dcb0 (diff)
downloadrails-eed3d3fff5ca6be00b2fe0fe020bd025ddbabbd5.tar.gz
rails-eed3d3fff5ca6be00b2fe0fe020bd025ddbabbd5.tar.bz2
rails-eed3d3fff5ca6be00b2fe0fe020bd025ddbabbd5.zip
Merge pull request #28742 from quixoten/stack_conn_pool
Switch to LIFO for the connection pool
Diffstat (limited to 'activerecord/test/cases/connection_pool_test.rb')
-rw-r--r--activerecord/test/cases/connection_pool_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb
index 2bfe490602..cb2fefb4f6 100644
--- a/activerecord/test/cases/connection_pool_test.rb
+++ b/activerecord/test/cases/connection_pool_test.rb
@@ -205,6 +205,14 @@ module ActiveRecord
end.join
end
+ def test_checkout_order_is_lifo
+ conn1 = @pool.checkout
+ conn2 = @pool.checkout
+ @pool.checkin conn1
+ @pool.checkin conn2
+ assert_equal [conn2, conn1], 2.times.map { @pool.checkout }
+ end
+
# The connection pool is "fair" if threads waiting for
# connections receive them in the order in which they began
# waiting. This ensures that we don't timeout one HTTP request