instance method
reap
Ruby on Rails 4.1.16
Since v4.0.13Signature
reap()
Removes dead connections from the pool. A dead connection can occur if a programmer forgets to close 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 392
def reap
synchronize do
stale = Time.now - @dead_connection_timeout
connections.dup.each do |conn|
if conn.in_use? && stale > conn.last_use && !conn.active_threadsafe?
remove conn
end
end
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 392
· View on GitHub
· Improve this page
· Find usages on GitHub