Class: Dionysus::Producer::Outbox::HealthCheck
- Inherits:
-
Object
- Object
- Dionysus::Producer::Outbox::HealthCheck
- Defined in:
- lib/dionysus/producer/outbox/health_check.rb
Instance Attribute Summary collapse
-
#expiry_time_in_seconds ⇒ Object
readonly
Returns the value of attribute expiry_time_in_seconds.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
Class Method Summary collapse
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(hostname: ENV.fetch("HOSTNAME", nil), expiry_time_in_seconds: 120) ⇒ HealthCheck
constructor
A new instance of HealthCheck.
- #register_heartbeat ⇒ Object
- #worker_stopped ⇒ Object
Constructor Details
#initialize(hostname: ENV.fetch("HOSTNAME", nil), expiry_time_in_seconds: 120) ⇒ HealthCheck
Returns a new instance of HealthCheck.
14 15 16 17 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 14 def initialize(hostname: ENV.fetch("HOSTNAME", nil), expiry_time_in_seconds: 120) @hostname = hostname @expiry_time_in_seconds = expiry_time_in_seconds end |
Instance Attribute Details
#expiry_time_in_seconds ⇒ Object (readonly)
Returns the value of attribute expiry_time_in_seconds.
12 13 14 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 12 def expiry_time_in_seconds @expiry_time_in_seconds end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
12 13 14 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 12 def hostname @hostname end |
Class Method Details
.check(hostname: ENV.fetch("HOSTNAME", nil), expiry_time_in_seconds: 120) ⇒ Object
8 9 10 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 8 def self.check(hostname: ENV.fetch("HOSTNAME", nil), expiry_time_in_seconds: 120) new(hostname: hostname, expiry_time_in_seconds: expiry_time_in_seconds).check end |
Instance Method Details
#check ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 19 def check if healthcheck_storage.running? "" else "[Dionysus Producer Outbox healthcheck failed]" end end |
#register_heartbeat ⇒ Object
27 28 29 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 27 def register_heartbeat healthcheck_storage.touch end |
#worker_stopped ⇒ Object
31 32 33 |
# File 'lib/dionysus/producer/outbox/health_check.rb', line 31 def worker_stopped healthcheck_storage.remove end |