global
def start(launcher)
def start(launcher) require_relative '../sd_notify' launcher.log_writer.log "* Enabling systemd notification integration" # hook_events launcher.events.on_booted { Puma::SdNotify.ready } launcher.events.on_stopped { Puma::SdNotify.stopping } launcher.events.on_restart { Puma::SdNotify.reloading } # start watchdog if Puma::SdNotify.watchdog? ping_f = watchdog_sleep_time in_background do launcher.log_writer.log "Pinging systemd watchdog every #{ping_f.round(1)} sec" loop do sleep ping_f Puma::SdNotify.watchdog end end end # start status loop instance = self sleep_time = 1.0 in_background do launcher.log_writer.log "Sending status to systemd every #{sleep_time.round(1)} sec" loop do sleep sleep_time # TODO: error handling? Puma::SdNotify.status(instance.status) end end end