instance method
checkout
Ruby on Rails 4.0.13
Since v2.2.3Signature
checkout()
Check-out a database connection from the pool, indicating that you want to use it. You should call #checkin when you no longer need this.
This is done by either returning and leasing existing connection, or by creating a new connection and leasing it.
If all connections are leased and the pool is at capacity (meaning the number of currently leased connections is greater than or equal to the size limit set), an ActiveRecord::ConnectionTimeoutError exception will be raised.
Returns: an AbstractAdapter object.
Raises:
-
ConnectionTimeoutError: no connection can be obtained from the pool.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 354
def checkout
synchronize do
conn = acquire_connection
conn.lease
checkout_and_verify(conn)
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 354
· View on GitHub
· Improve this page
· Find usages on GitHub