Class: Falcon::Command::Serve

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/falcon/command.rb

Instance Method Summary collapse

Instance Method Details

#container_classObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/falcon/command.rb', line 55

def container_class
  case @options[:container]
  when :threaded
    require 'async/container/threaded'
    return Async::Container::Threaded
  when :forked
    require 'async/container/forked'
    return Async::Container::Forked
  end
end

#invokeObject



78
79
80
81
82
# File 'lib/falcon/command.rb', line 78

def invoke
  run
  
  sleep
end

#runObject



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/falcon/command.rb', line 66

def run
  app, options = Rack::Builder.parse_file(@options[:config])
  
  container_class.new(concurrency: @options[:concurrency]) do
    server = Falcon::Server.new(app, [
      Async::IO::Endpoint.parse(@options[:bind], reuse_port: true)
    ])
    
    server.run
  end
end