aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/hot_compatibility_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/hot_compatibility_test.rb')
-rw-r--r--activerecord/test/cases/hot_compatibility_test.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/test/cases/hot_compatibility_test.rb b/activerecord/test/cases/hot_compatibility_test.rb
index 42e7235fba..e0946544ef 100644
--- a/activerecord/test/cases/hot_compatibility_test.rb
+++ b/activerecord/test/cases/hot_compatibility_test.rb
@@ -114,29 +114,29 @@ class HotCompatibilityTest < ActiveRecord::TestCase
private
- def get_prepared_statement_cache(connection)
- connection.instance_variable_get(:@statements)
- .instance_variable_get(:@cache)[Process.pid]
- end
+ def get_prepared_statement_cache(connection)
+ connection.instance_variable_get(:@statements)
+ .instance_variable_get(:@cache)[Process.pid]
+ end
# Rails will automatically clear the prepared statements on the connection
# that runs the migration, so we use two connections to simulate what would
# actually happen on a production system; we'd have one connection running the
# migration from the rake task ("ddl_connection" here), and we'd have another
# connection in a web worker.
- def with_two_connections
- run_without_connection do |original_connection|
- ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))
- begin
- ddl_connection = ActiveRecord::Base.connection_pool.checkout
+ def with_two_connections
+ run_without_connection do |original_connection|
+ ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))
begin
- yield original_connection, ddl_connection
+ ddl_connection = ActiveRecord::Base.connection_pool.checkout
+ begin
+ yield original_connection, ddl_connection
+ ensure
+ ActiveRecord::Base.connection_pool.checkin ddl_connection
+ end
ensure
- ActiveRecord::Base.connection_pool.checkin ddl_connection
+ ActiveRecord::Base.clear_all_connections!
end
- ensure
- ActiveRecord::Base.clear_all_connections!
end
end
- end
end