Module: PgbConnectionReaperRb::Reaper
- Defined in:
- lib/pgb_connection_reaper_rb/reaper.rb
Instance Attribute Summary collapse
-
#connected_at ⇒ Object
readonly
Returns the value of attribute connected_at.
-
#pgb_ttl ⇒ Object
readonly
Returns the value of attribute pgb_ttl.
Instance Method Summary collapse
Instance Attribute Details
#connected_at ⇒ Object (readonly)
Returns the value of attribute connected_at.
15 16 17 |
# File 'lib/pgb_connection_reaper_rb/reaper.rb', line 15 def connected_at @connected_at end |
#pgb_ttl ⇒ Object (readonly)
Returns the value of attribute pgb_ttl.
15 16 17 |
# File 'lib/pgb_connection_reaper_rb/reaper.rb', line 15 def pgb_ttl @pgb_ttl end |
Instance Method Details
#initialize(*args) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/pgb_connection_reaper_rb/reaper.rb', line 7 def initialize(*args) super config = get_db_config @connected_at = Concurrent.monotonic_time @pgb_ttl = self.class.type_cast_config_to_integer(config.fetch(:pgb_ttl, nil)) end |
#reconnect!(**args) ⇒ Object
17 18 19 20 |
# File 'lib/pgb_connection_reaper_rb/reaper.rb', line 17 def reconnect!(**args) super @connected_at = Concurrent.monotonic_time end |
#verify! ⇒ Object
22 23 24 25 |
# File 'lib/pgb_connection_reaper_rb/reaper.rb', line 22 def verify!() super reconnect! if eligible? end |