Class: Puma::Systemd
- Inherits:
-
Object
- Object
- Puma::Systemd
- Defined in:
- lib/puma/systemd.rb
Instance Method Summary collapse
- #hook_events ⇒ Object
-
#initialize(events) ⇒ Systemd
constructor
A new instance of Systemd.
- #start_watchdog ⇒ Object
Constructor Details
#initialize(events) ⇒ Systemd
Returns a new instance of Systemd.
7 8 9 |
# File 'lib/puma/systemd.rb', line 7 def initialize(events) @events = events end |
Instance Method Details
#hook_events ⇒ Object
11 12 13 14 15 |
# File 'lib/puma/systemd.rb', line 11 def hook_events @events.on_booted { SdNotify.ready } @events.on_stopped { SdNotify.stopping } @events.on_restart { SdNotify.reloading } end |
#start_watchdog ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/puma/systemd.rb', line 17 def start_watchdog return unless SdNotify.watchdog? ping_f = watchdog_sleep_time log "Pinging systemd watchdog every #{ping_f.round(1)} sec" Thread.new do loop do sleep ping_f SdNotify.watchdog end end end |