class ActiveRecord::ConnectionAdapters::ConnectionPool

def acquire_connection(checkout_timeout)

Experimental RBS support (using type sampling data from the type_fusion project).

def acquire_connection: (Float checkout_timeout) -> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

This signature was generated using 5 samples from 1 application.

will already be "+connection.lease+ -ed" to the current thread.
Implementation detail: the connection returned by +acquire_connection+
--

- ActiveRecord::ConnectionTimeoutError if a connection could not be acquired
Raises:

queue for a connection to become available.
connection if the pool is not at capacity, 3) waiting on the
from the queue of available connections, 2) creating a new
Acquire a connection by one of 1) immediately removing one
def acquire_connection(checkout_timeout)
  # NOTE: we rely on <tt>@available.poll</tt> and +try_to_checkout_new_connection+ to
  # +conn.lease+ the returned connection (and to do this in a +synchronized+
  # section). This is not the cleanest implementation, as ideally we would
  # <tt>synchronize { conn.lease }</tt> in this method, but by leaving it to <tt>@available.poll</tt>
  # and +try_to_checkout_new_connection+ we can piggyback on +synchronize+ sections
  # of the said methods and avoid an additional +synchronize+ overhead.
  if conn = @available.poll || try_to_checkout_new_connection
    conn
  else
    reap
    @available.poll(checkout_timeout)
  end
end