instance method
retrieve_connection_pool
Ruby on Rails 7.1.6
Since v2.2.3Signature
retrieve_connection_pool(connection_name, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
Retrieving the connection pool happens a lot, so we cache it in @connection_name_to_pool_manager. This makes retrieving the connection pool O(1) once the process is warm. When a connection is established or removed, we invalidate the cache.
Parameters
-
connection_namereq -
rolekey = ActiveRecord::Base.current_role -
shardkey = ActiveRecord::Base.current_shard
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb, line 265
def retrieve_connection_pool(connection_name, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
pool_config = get_pool_manager(connection_name)&.get_pool_config(role, shard)
pool_config&.pool
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb line 265
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::ConnectionHandler