class ActiveRecord::ConnectionAdapters::ConnectionPool
def initialize(pool_config)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (*unused *) -> void
This signature was generated using 1 sample from 1 application.
this ConnectionPool.
host name, username, password, etc), as well as the maximum size for
object which describes database connection information (e.g. adapter,
Creates a new ConnectionPool object. +pool_config+ is a PoolConfig
def initialize(pool_config) super() @pool_config = pool_config @db_config = pool_config.db_config @connection_class = pool_config.connection_class @role = pool_config.role @shard = pool_config.shard @checkout_timeout = db_config.checkout_timeout @idle_timeout = db_config.idle_timeout @size = db_config.pool # This variable tracks the cache of threads mapped to reserved connections, with the # sole purpose of speeding up the +connection+ method. It is not the authoritative # registry of which thread owns which connection. Connection ownership is tracked by # the +connection.owner+ attr on each +connection+ instance. # The invariant works like this: if there is mapping of <tt>thread => conn</tt>, # then that +thread+ does indeed own that +conn+. However, an absence of such # mapping does not mean that the +thread+ doesn't own the said connection. In # that case +conn.owner+ attr should be consulted. # Access and modification of <tt>@thread_cached_conns</tt> does not require # synchronization. @thread_cached_conns = Concurrent::Map.new(initial_capacity: @size) @connections = [] @automatic_reconnect = true # Connection pool allows for concurrent (outside the main +synchronize+ section) # establishment of new connections. This variable tracks the number of threads # currently in the process of independently establishing connections to the DB. @now_connecting = 0 @threads_blocking_new_connections = 0 @available = ConnectionLeasingQueue.new self @lock_thread = false @async_executor = build_async_executor lazily_set_schema_cache @reaper = Reaper.new(self, db_config.reaping_frequency) @reaper.run end