Sha256: 960bf1cec3c7fb960e5345b8e311ef9b01584b69d8680aadef8dbd5975cb4e8a

Contents?: true

Size: 454 Bytes

Versions: 3

Compression:

Stored size: 454 Bytes

Contents

require 'populus/watch_thread'
require 'securerandom'

module Populus
  module Daemon
    def self.run(setting: nil)
      raise ArgumentError unless setting
      Populus.eval_setting(setting)
      threads = Populus::Pool.gen_threads

      trap(:INT) do
        STDERR.puts "Caught SIGINT. Quitting..."
        threads.each(&:kill)
      end

      threads.each(&:join)
      Populus.logger.warn "Consul process exited. Aborting..."
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
populus-0.0.4 lib/populus/daemon.rb
populus-0.0.3 lib/populus/daemon.rb
populus-0.0.1 lib/populus/daemon.rb