instance method preconnect

Ruby on Rails 8.1.2

Since v8.1.2

Signature

preconnect()

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.

Source
# 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

Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 810 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::ConnectionPool

Type at least 2 characters to search.

↑↓ navigate · open · esc close