Shares the writing connection pool with connections on other handlers.
In an application with a primary and replica the test fixtures need to
share a connection pool so that the reading connection can see data in the
open transaction on the writing connection.
# File activerecord/lib/active_record/test_fixtures.rb, line 220
def setup_shared_connection_pool
handler = ActiveRecord::Base.connection_handler
handler.connection_pool_names.each do |name|
pool_manager = handler.send(:connection_name_to_pool_manager)[name]
pool_manager.shard_names.each do |shard_name|
writing_pool_config = pool_manager.get_pool_config(ActiveRecord.writing_role, shard_name)
@saved_pool_configs[name][shard_name] ||= {}
pool_manager.role_names.each do |role|
next unless pool_config = pool_manager.get_pool_config(role, shard_name)
next if pool_config == writing_pool_config
@saved_pool_configs[name][shard_name][role] = pool_config
pool_manager.set_pool_config(role, shard_name, writing_pool_config)
end
end
end
end