Class: JetstreamBridge::Consumer::ConnectionState
- Inherits:
-
Object
- Object
- JetstreamBridge::Consumer::ConnectionState
- Defined in:
- lib/jetstream_bridge/consumer/consumer_state.rb
Overview
Tracks reconnection attempts and health check timing.
Instance Attribute Summary collapse
-
#last_health_check ⇒ Time
readonly
When the last health check was performed.
-
#reconnect_attempts ⇒ Integer
Number of consecutive reconnection attempts.
Instance Method Summary collapse
-
#initialize(now: Time.now) ⇒ ConnectionState
constructor
A new instance of ConnectionState.
-
#mark_health_check(now = Time.now) ⇒ void
Record that a health check was performed.
Constructor Details
#initialize(now: Time.now) ⇒ ConnectionState
Returns a new instance of ConnectionState.
76 77 78 79 |
# File 'lib/jetstream_bridge/consumer/consumer_state.rb', line 76 def initialize(now: Time.now) @reconnect_attempts = 0 @last_health_check = now end |
Instance Attribute Details
#last_health_check ⇒ Time (readonly)
Returns When the last health check was performed.
73 74 75 |
# File 'lib/jetstream_bridge/consumer/consumer_state.rb', line 73 def last_health_check @last_health_check end |
#reconnect_attempts ⇒ Integer
Returns Number of consecutive reconnection attempts.
71 72 73 |
# File 'lib/jetstream_bridge/consumer/consumer_state.rb', line 71 def reconnect_attempts @reconnect_attempts end |
Instance Method Details
#mark_health_check(now = Time.now) ⇒ void
This method returns an undefined value.
Record that a health check was performed.
85 86 87 |
# File 'lib/jetstream_bridge/consumer/consumer_state.rb', line 85 def mark_health_check(now = Time.now) @last_health_check = now end |