Skip to content

Commit

Permalink
Updated documentation and fixed the spinner to reference the new spaw…
Browse files Browse the repository at this point in the history
…ner by default

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2610 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Oct 15, 2005
1 parent 0930256 commit 50f3c3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
7 changes: 2 additions & 5 deletions railties/lib/commands/process/reaper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,10 @@ def to_s
Restart is the most common and default action.
A nudge is simply a request to a URL where the dispatcher is serving. You should perform one nudge per
FCGI process you have running if they're setup in a round-robin. Be sure to do one nudge per FCGI process
across all your servers. So three servers with 10 processes each should nudge 30 times to be sure all processes
are restarted.
Examples:
reaper # restarts the default dispatcher
reaper -a reload
reaper -a exit -d /my/special/dispatcher.fcgi
EOF

opts.on(" Options:")
Expand Down
24 changes: 8 additions & 16 deletions railties/lib/commands/process/spinner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ def daemonize
end

OPTIONS = {
:high_interval => 5.0,
:low_interval => 0.5,
:command => File.expand_path(RAILS_ROOT + '/script/run process spawner'),
:daemon => false
:interval => 5.0,
:command => File.expand_path(RAILS_ROOT + '/script/process/spawner'),
:daemon => false
}

ARGV.options do |opts|
Expand All @@ -26,7 +25,7 @@ def daemonize
opts.on <<-EOF
Description:
The spinner is a protection loop for the spawner, which will attempt to restart any FCGI processes
that might have been restarted or outright crashed. It's a brute-force attempt that'll just try
that might have been exited or outright crashed. It's a brute-force attempt that'll just try
to run the spawner every X number of seconds, so it does pose a light load on the server.
Examples:
Expand All @@ -37,10 +36,9 @@ def daemonize

opts.on(" Options:")

opts.on("-c", "--command=path", String) { |OPTIONS[:command]| }
opts.on("-h", "--high-interval=seconds", Float) { |OPTIONS[:high_interval]| }
opts.on("-l", "--low-interval=seconds", Float) { |OPTIONS[:low_interval]| }
opts.on("-d", "--daemon") { |OPTIONS[:daemon]| }
opts.on("-c", "--command=path", String) { |OPTIONS[:command]| }
opts.on("-i", "--interval=seconds", Float) { |OPTIONS[:interval]| }
opts.on("-d", "--daemon") { |OPTIONS[:daemon]| }

opts.separator ""

Expand All @@ -52,14 +50,8 @@ def daemonize
daemonize if OPTIONS[:daemon]

trap(OPTIONS[:daemon] ? "TERM" : "INT") { exit }
trap("USR1") do
$interval = ($interval == OPTIONS[:high_interval] ? OPTIONS[:low_interval] : OPTIONS[:high_interval])
puts "New interval: #{$interval}"
end

$interval = OPTIONS[:high_interval]

loop do
system(OPTIONS[:command])
sleep($interval)
sleep(OPTIONS[:interval])
end

0 comments on commit 50f3c3c

Please sign in to comment.