class Reaper
Ruby on Rails 8.1.2
Since v4.0.13Active Record Connection Pool Reaper
The reaper is a singleton that exists in the background of the process and is responsible for general maintenance of all the connection pools.
It will reclaim connections that are leased to now-dead threads, ensuring that a bad thread can’t leak a pool slot forever. By definition, this involves touching currently-leased connections, but that is safe because the owning thread is known to be dead.
Beyond that, it manages the health of available / unleased connections:
* retiring connections that have been idle[1] for too long * creating occasional activity on inactive[1] connections * keeping the pool prepopulated up to its minimum size * proactively connecting to the target database from any pooled connections that had lazily deferred that step * resetting or replacing connections that are known to be broken
[1]: “idle” and “inactive” here distinguish between connections that have not been requested by the application in a while (idle) and those that have not spoken to their remote server in a while (inactive). The former is a desirable opportunity to reduce our connection count (idle_timeout); the latter is a risk that the server or a firewall may drop a connection we still anticipate using (avoided by keepalive).
Inherits from
Attributes
Methods (defined here)
Private methods
(1)
Implementation detail — not part of the public API.
- self. spawn_thread
Methods (inherited)
From Object (17)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with
- # with_options
From ActiveSupport::NumericWithFormat (2)
- # to_formatted_s
- # to_fs