instance method
reap
Ruby on Rails 4.2.9
Since v4.0.13Signature
reap()
Recover lost connections for the pool. A lost connection can occur if a programmer forgets to checkin a connection at the end of a thread or a thread dies unexpectedly.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 390
def reap
stale_connections = synchronize do
@connections.select do |conn|
conn.in_use? && !conn.owner.alive?
end
end
stale_connections.each do |conn|
synchronize do
if conn.active?
conn.reset!
checkin conn
else
remove conn
end
end
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 390
· View on GitHub
· Improve this page
· Find usages on GitHub