Module: Infield::Heartbeat::Runner
- Defined in:
- lib/infield/heartbeat.rb
Class Attribute Summary collapse
-
.thread ⇒ Object
readonly
Returns the value of attribute thread.
Class Method Summary collapse
Class Attribute Details
.thread ⇒ Object (readonly)
Returns the value of attribute thread.
7 8 9 |
# File 'lib/infield/heartbeat.rb', line 7 def thread @thread end |
Class Method Details
.run(interval: 60) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/infield/heartbeat.rb', line 9 def run(interval: 60) @thread = Thread.new do loop do if DeprecationWarning::Runner.thread&.alive? send_heartbeat else stop break end sleep(interval) end end end |
.stop ⇒ Object
23 24 25 |
# File 'lib/infield/heartbeat.rb', line 23 def stop @thread&.kill end |