Module: SubZero::Runner
- Included in:
- Service
- Defined in:
- lib/sub_zero/service/runner.rb
Instance Method Summary collapse
Instance Method Details
#run! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sub_zero/service/runner.rb', line 4 def run! Daemons.run_proc sid, daemon_configuration do start = Time.now ping_at = start + 5 Signal.trap('INT') { socket.down!; exit } Signal.trap('TERM') { socket.down!; exit } socket.up! loop do socket.run &method(:resolve) now = Time.now if now >= ping_at socket.ping ping_at = now + 15 end break if $stop_requested end socket.down! exit 0 end end |