Skip to content

Commit

Permalink
mongrel_rails: support -n/--num-procs command-line option
Browse files Browse the repository at this point in the history
Also added "num_procs" support in the config file as
an alias to "num_processors" to make it easier to
migrate configs from/to mongrel_cluster.

ref: http://mongrel.rubyforge.org/ticket/14


git-svn-id: svn://rubyforge.org/var/svn/mongrel/trunk@987 19e92222-5c0b-0410-8929-a290d50e31e9
  • Loading branch information
normalperson committed Mar 2, 2008
1 parent 5d6853a commit 2991f75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/mongrel_rails
Expand Up @@ -28,7 +28,7 @@ module Mongrel
['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024],
['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_processors, 1024],
['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, 60],
['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, 0],
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
Expand Down Expand Up @@ -170,6 +170,7 @@ module Mongrel
key = key.to_s
if config_keys.include?(key)
key = 'address' if key == 'host'
key = 'num_processors' if key == 'num_procs'
self.instance_variable_set("@#{key}", value)
else
failure "Unknown configuration setting: #{key}"
Expand All @@ -180,13 +181,14 @@ module Mongrel

def config_keys
@config_keys ||=
%w(address host port cwd log_file pid_file environment docroot mime_map daemon debug includes config_script num_processors timeout throttle user group prefix)
%w(address host port cwd log_file pid_file environment docroot mime_map daemon debug includes config_script num_processors num_procs timeout throttle user group prefix)
end

def settings
config_keys.inject({}) do |hash, key|
value = self.instance_variable_get("@#{key}")
key = 'host' if key == 'address'
key = 'num_processors' if key == 'num_procs'
hash[key.to_sym] ||= value
hash
end
Expand Down

0 comments on commit 2991f75

Please sign in to comment.