1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

mongrel_rails and mongrel_cluster support throttle/timeout appropriately

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@729 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
evanweaver 2007-10-22 07:26:12 +00:00
parent f2cde5ce07
commit e5ceebe3e9
2 changed files with 19 additions and 13 deletions

View file

@ -57,6 +57,9 @@ module Mongrel
# Register a handler object at a particular URI. The handler can be whatever # Register a handler object at a particular URI. The handler can be whatever
# you want, including an array. It's up to you what to do with it. # you want, including an array. It's up to you what to do with it.
#
# Registering a handler is not necessarily threadsafe, so be careful if you go
# mucking around once the server is running.
def register(uri, handler) def register(uri, handler)
raise RegistrationError, "#{uri.inspect} is already registered" if @routes[uri] raise RegistrationError, "#{uri.inspect} is already registered" if @routes[uri]
raise RegistrationError, "URI is empty" if !uri or uri.empty? raise RegistrationError, "URI is empty" if !uri or uri.empty?

View file

@ -62,18 +62,19 @@ module Cluster
argv = [ "mongrel_rails" ] argv = [ "mongrel_rails" ]
argv << "start" argv << "start"
argv << "-d" argv << "-d"
argv << "-e #{@options["environment"]}" if @options["environment"] argv << "-e #{@options['environment']}" if @options['environment']
argv << "-a #{@options["address"]}" if @options["address"] argv << "-a #{@options['address']}" if @options['address']
argv << "-c #{@options["cwd"]}" if @options["cwd"] argv << "-c #{@options['cwd']}" if @options['cwd']
argv << "-t #{@options["timeout"]}" if @options["timeout"] argv << "-o #{@options['timeout']}" if @options['timeout']
argv << "-m #{@options["mime_map"]}" if @options["mime_map"] argv << "-t #{@options['throttle']}" if @options['throttle']
argv << "-r #{@options["docroot"]}" if @options["docroot"] argv << "-m #{@options['mime_map']}" if @options['mime_map']
argv << "-n #{@options["num_procs"]}" if @options["num_procs"] argv << "-r #{@options['docroot']}" if @options['docroot']
argv << "-B" if @options["debug"] argv << "-n #{@options['num_procs']}" if @options['num_procs']
argv << "-S #{@options["config_script"]}" if @options["config_script"] argv << "-B" if @options['debug']
argv << "--user #{@options["user"]}" if @options["user"] argv << "-S #{@options['config_script']}" if @options['config_script']
argv << "--group #{@options["group"]}" if @options["group"] argv << "--user #{@options['user']}" if @options['user']
argv << "--prefix #{@options["prefix"]}" if @options["prefix"] argv << "--group #{@options['group']}" if @options['group']
argv << "--prefix #{@options['prefix']}" if @options['prefix']
cmd = argv.join " " cmd = argv.join " "
@ports.each do |port| @ports.each do |port|
@ -287,7 +288,8 @@ module Cluster
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"], ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"], ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"],
['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil], ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
['-t', '--timeout TIME', "Time to pause (in hundredths of a second) between accepting clients", :@timeout, nil], ['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, nil],
['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, nil],
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil], ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil], ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil],
['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil], ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil],
@ -323,6 +325,7 @@ module Cluster
@options["docroot"] = @docroot if @docroot @options["docroot"] = @docroot if @docroot
@options["address"] = @address if @address @options["address"] = @address if @address
@options["timeout"] = @timeout if @timeout @options["timeout"] = @timeout if @timeout
@options["throttle"] = @throttle if @throttle
@options["environment"] = @environment if @environment @options["environment"] = @environment if @environment
@options["mime_map"] = @mime_map if @mime_map @options["mime_map"] = @mime_map if @mime_map
@options["config_script"] = @config_script if @config_script @options["config_script"] = @config_script if @config_script