instance method
disconnect
Ruby on Rails 8.0.4
Since v5.2.8.1Signature
disconnect(raise_on_acquisition_timeout = true)
Disconnects all connections in the pool, and clears the pool.
Raises:
-
ActiveRecord::ExclusiveConnectionTimeoutError if unable to gain ownership of all connections in the pool within a timeout interval (default duration is
spec.db_config.checkout_timeout * 2seconds).
Parameters
-
raise_on_acquisition_timeoutopt = true
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 456
def disconnect(raise_on_acquisition_timeout = true)
with_exclusively_acquired_all_connections(raise_on_acquisition_timeout) do
synchronize do
@connections.each do |conn|
if conn.in_use?
conn.steal!
checkin conn
end
conn.disconnect!
end
@connections = []
@leases.clear
@available.clear
end
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 456
· View on GitHub
· Improve this page
· Find usages on GitHub