instance method
retrieve_connection_pool
Ruby on Rails 6.1.7.10
Since v2.2.3Signature
retrieve_connection_pool(owner, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
Retrieving the connection pool happens a lot, so we cache it in @owner_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
-
ownerreq -
rolekey = ActiveRecord::Base.current_role -
shardkey = ActiveRecord::Base.current_shard
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 1161
def retrieve_connection_pool(owner, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
pool_config = get_pool_manager(owner)&.get_pool_config(role, shard)
pool_config&.pool
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 1161
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::ConnectionHandler