Sha256: 00e0bed967b170da0e0ccea77c43fb332905ac7fa60b0c433f67997c3ae05041

Contents?: true

Size: 804 Bytes

Versions: 12

Compression:

Stored size: 804 Bytes

Contents

module RedisFailover
  # Runner is responsible for bootstrapping the Node Manager.
  class Runner
    # Launches the Node Manager in a background thread.
    #
    # @param [Array] options the command-line options
    # @note this method blocks and does not return until the
    #   Node Manager is gracefully stopped
    def self.run(options)
      options = CLI.parse(options)
      @node_manager = NodeManager.new(options)
      trap_signals
      node_manager_thread = Thread.new { @node_manager.start }
      node_manager_thread.join
    end

    # Traps shutdown signals.
    def self.trap_signals
      [:INT, :TERM].each do |signal|
        trap(signal) do
          Util.logger.info('Shutting down ...')
          @node_manager.shutdown
          exit(0)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
nogara-redis_failover-0.8.11 lib/redis_failover/runner.rb
nogara-redis_failover-0.8.10 lib/redis_failover/runner.rb
nogara-redis_failover-0.8.9 lib/redis_failover/runner.rb
redis_failover-0.8.9 lib/redis_failover/runner.rb
redis_failover-0.8.8 lib/redis_failover/runner.rb
redis_failover-0.8.7 lib/redis_failover/runner.rb
redis_failover-0.8.6 lib/redis_failover/runner.rb
redis_failover-0.8.5 lib/redis_failover/runner.rb
redis_failover-0.8.4 lib/redis_failover/runner.rb
redis_failover-0.8.3 lib/redis_failover/runner.rb
redis_failover-0.8.2 lib/redis_failover/runner.rb
redis_failover-0.8.1 lib/redis_failover/runner.rb