aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-28 19:31:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-28 19:31:41 +0000
commit8e4f27a50a1c7e70d7f0383cbb9d4a04d2f3ddbd (patch)
tree5899461789102bb1ca3d8094d428e18e2d12de6e
parentfc83920383b5f839cd6badbc5c962be9383fe150 (diff)
downloadrails-8e4f27a50a1c7e70d7f0383cbb9d4a04d2f3ddbd.tar.gz
rails-8e4f27a50a1c7e70d7f0383cbb9d4a04d2f3ddbd.tar.bz2
rails-8e4f27a50a1c7e70d7f0383cbb9d4a04d2f3ddbd.zip
Solved the hanging issue.. USR2 is now the preferred way of restarting FCGIs!
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2399 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/lib/fcgi_handler.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb
index 3124a1e5e6..ee33c7ff36 100644
--- a/railties/lib/fcgi_handler.rb
+++ b/railties/lib/fcgi_handler.rb
@@ -64,7 +64,14 @@ class RailsFCGIHandler
process_request(cgi)
# Break if graceful exit or restart requested.
- break if when_ready == :exit || when_ready == :restart
+ case when_ready
+ when :exit
+ close_connection
+ break
+ when :restart
+ close_connection
+ restart!
+ end
# Garbage collection countdown.
if gc_request_period
@@ -73,8 +80,6 @@ class RailsFCGIHandler
end
end
- restart! if when_ready == :restart
-
GC.enable
dispatcher_log :info, "terminated gracefully"
@@ -172,4 +177,8 @@ class RailsFCGIHandler
@gc_request_countdown = gc_request_period
GC.enable; GC.start; GC.disable
end
+
+ def close_connection
+ cgi.instance_variable_get("@request").finish
+ end
end