lib/legion/process.rb in legionio-0.2.0 vs lib/legion/process.rb in legionio-0.3.0
- old
+ new
@@ -1,11 +1,8 @@
-# frozen_string_literal: true
-
require 'fileutils'
module Legion
- # Responsible for starting the Legion process
class Process
def self.run!(options)
Legion::Process.new(options).run!
end
@@ -49,11 +46,11 @@
daemonize if daemonize?
write_pid
trap_signals
until quit
- sleep(1) # in real life, something productive would happen here
+ sleep(1)
if @options.key? :time_limit
@quit = true if Time.now - start_time > @options[:time_limit]
end
end
Legion::Logging.info('Legion is shutting down!')
@@ -111,19 +108,10 @@
:dead
rescue Errno::EPERM
:not_owned
end
- #==========================================================================
- # SIGNAL HANDLING
- #==========================================================================
-
def trap_signals
- # trap(:QUIT) do # graceful shutdown
- # info 'shutting down'
- # @quit = true
- # end
-
trap('SIGTERM') do
info 'sigterm'
end
trap('SIGHUP') do