method
preconnect
rails latest stable - Class:
ActiveRecord::ConnectionAdapters::ConnectionPool
Method not available on this version
This method is only available on newer versions. The first available version (v8.1.1) is shown here.
preconnect()public
Preconnect all connections in the pool. This saves pool users from having to wait for a connection to be established when first using it after checkout.
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 810
def preconnect
sequential_maintenance -> c { (!c.connected? || !c.verified?) && c.allow_preconnect } do |conn|
conn.connect!
rescue
# Wholesale rescue: there's nothing we can do but move on. The
# connection will go back to the pool, and the next consumer will
# presumably try to connect again -- which will either work, or
# fail and they'll be able to report the exception.
end
end Related methods
- Instance methods
- activate
- activated?
- active_connection
- active_connection?
- checkin
- checkout
- clear_reloadable_connections
- clear_reloadable_connections!
- connected?
- connection_descriptor
- connections
- discard!
- discarded?
- disconnect
- disconnect!
- flush
- flush!
- inspect
- internal_metadata
- keep_alive
- lease_connection
- maintainable?
- migration_context
- migrations_paths
- new_connection
- num_available_in_queue
- num_waiting_in_queue
- permanent_lease?
- pin_connection!
- pool_transaction_isolation_level
- pool_transaction_isolation_level=
- preconnect
- prepopulate
- reap
- reaper_lock
- recycle!
- release_connection
- remove
- retire_old_connections
- schedule_query
- schema_cache
- schema_migration
- schema_reflection=
- stat
- unpin_connection!
- with_connection
- with_pool_transaction_isolation_level
- Class methods
- install_executor_hooks
- new
- Private methods
-
acquire_connection -
adopt_connection -
attempt_to_checkout_all_existing_connections -
build_async_executor -
bulk_make_new_connections -
checkout_and_verify -
checkout_for_exclusive_access -
checkout_for_maintenance -
checkout_new_connection -
connection_lease -
name_inspect -
release -
remove_connection_from_thread_cache -
remove_from_maintenance -
return_from_maintenance -
sequential_maintenance -
shard_inspect -
try_to_checkout_new_connection -
try_to_queue_for_background_connection -
with_exclusively_acquired_all_connections -
with_new_connections_blocked