method
prepopulate
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.
prepopulate()public
Ensure that the pool contains at least the configured minimum number of connections.
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 776
def prepopulate
need_new_connections = nil
synchronize do
return if self.discarded?
# We don't want to start prepopulating until we know the pool is wanted,
# so we can avoid maintaining full pools in one-off scripts etc.
return unless @activated
need_new_connections = @connections.size < @min_connections
end
if need_new_connections
while new_conn = try_to_checkout_new_connection { @connections.size < @min_connections }
new_conn.allow_preconnect = true
checkin(new_conn)
end
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