Sha256: 423d4b083f95d88d08a4fc2b7b69d63b8174748bb815ace582bcb539cebf333e

Contents?: true

Size: 584 Bytes

Versions: 6

Compression:

Stored size: 584 Bytes

Contents

module Ringleader
  class Controller
    include Celluloid
    include Celluloid::Logger

    def initialize(configs)
      @apps = {}
      configs.each do |name, config|
        @apps[name] = App.new(config)
      end
    end

    def apps
      @apps.values.sort_by { |a| a.name }
    end

    def app(name)
      @apps[name]
    end

    def stop
      exit if @stopping # if ctrl-c called twice...
      @stopping = true
      info "shutting down..."
      @apps.values.map do |app|
        Thread.new { app.stop(:forever) if app.alive? }
      end.map(&:join)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ringleader-1.1.8 lib/ringleader/controller.rb
ringleader-1.1.7 lib/ringleader/controller.rb
ringleader-1.1.6 lib/ringleader/controller.rb
ringleader-1.1.5 lib/ringleader/controller.rb
ringleader-1.1.5.pre2 lib/ringleader/controller.rb
ringleader-1.1.5.pre1 lib/ringleader/controller.rb