Skip to content

Commit

Permalink
Fix default_concurrency for older rubies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jun 16, 2017
1 parent 46b5e56 commit 93a19b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/falcon/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@

module Falcon
module Command
def self.default_concurrency
Etc.nprocessors
rescue
2
end

def self.parse(*args)
Top.parse(*args)
end
Expand All @@ -39,7 +45,7 @@ class Serve < Samovar::Command

options do
option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
option '-n/--concurrency <count>', "Number of processes to start", default: Etc.nprocessors, type: Integer
option '-n/--concurrency <count>', "Number of processes to start", default: Command.default_concurrency, type: Integer

option '-b/--bind <address>', "Bind to the given hostname/address", default: "tcp://localhost:9292"
end
Expand Down

0 comments on commit 93a19b3

Please sign in to comment.