From e5ceebe3e9b97dec1bcdce9a055c361022e074aa Mon Sep 17 00:00:00 2001 From: evanweaver Date: Mon, 22 Oct 2007 07:26:12 +0000 Subject: 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 --- lib/mongrel.rb | 3 +++ .../mongrel_cluster/lib/mongrel_cluster/init.rb | 29 ++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/mongrel.rb b/lib/mongrel.rb index d4e0f56..28baace 100644 --- a/lib/mongrel.rb +++ b/lib/mongrel.rb @@ -57,6 +57,9 @@ module Mongrel # 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. + # + # Registering a handler is not necessarily threadsafe, so be careful if you go + # mucking around once the server is running. def register(uri, handler) raise RegistrationError, "#{uri.inspect} is already registered" if @routes[uri] raise RegistrationError, "URI is empty" if !uri or uri.empty? diff --git a/projects/mongrel_cluster/lib/mongrel_cluster/init.rb b/projects/mongrel_cluster/lib/mongrel_cluster/init.rb index fbb1e61..6c0a8e8 100644 --- a/projects/mongrel_cluster/lib/mongrel_cluster/init.rb +++ b/projects/mongrel_cluster/lib/mongrel_cluster/init.rb @@ -62,18 +62,19 @@ module Cluster argv = [ "mongrel_rails" ] argv << "start" argv << "-d" - argv << "-e #{@options["environment"]}" if @options["environment"] - argv << "-a #{@options["address"]}" if @options["address"] - argv << "-c #{@options["cwd"]}" if @options["cwd"] - argv << "-t #{@options["timeout"]}" if @options["timeout"] - argv << "-m #{@options["mime_map"]}" if @options["mime_map"] - argv << "-r #{@options["docroot"]}" if @options["docroot"] - argv << "-n #{@options["num_procs"]}" if @options["num_procs"] - argv << "-B" if @options["debug"] - argv << "-S #{@options["config_script"]}" if @options["config_script"] - argv << "--user #{@options["user"]}" if @options["user"] - argv << "--group #{@options["group"]}" if @options["group"] - argv << "--prefix #{@options["prefix"]}" if @options["prefix"] + argv << "-e #{@options['environment']}" if @options['environment'] + argv << "-a #{@options['address']}" if @options['address'] + argv << "-c #{@options['cwd']}" if @options['cwd'] + argv << "-o #{@options['timeout']}" if @options['timeout'] + argv << "-t #{@options['throttle']}" if @options['throttle'] + argv << "-m #{@options['mime_map']}" if @options['mime_map'] + argv << "-r #{@options['docroot']}" if @options['docroot'] + argv << "-n #{@options['num_procs']}" if @options['num_procs'] + argv << "-B" if @options['debug'] + argv << "-S #{@options['config_script']}" if @options['config_script'] + argv << "--user #{@options['user']}" if @options['user'] + argv << "--group #{@options['group']}" if @options['group'] + argv << "--prefix #{@options['prefix']}" if @options['prefix'] cmd = argv.join " " @ports.each do |port| @@ -287,7 +288,8 @@ module Cluster ['-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"], ['-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], ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, 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["address"] = @address if @address @options["timeout"] = @timeout if @timeout + @options["throttle"] = @throttle if @throttle @options["environment"] = @environment if @environment @options["mime_map"] = @mime_map if @mime_map @options["config_script"] = @config_script if @config_script -- cgit v1.2.3-24-ge0c7