From 3cc47a4297d9c43e88972555e853e2d5359d804f Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Wed, 29 Jun 2005 11:07:20 +0000 Subject: Use SIGHUP to dynamically reload an fcgi process without restarting it. Refactored dispatch.fcgi so that the RailsFCGIHandler is in the lib dir. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1565 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/dispatcher.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'railties/lib/dispatcher.rb') diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 1455168ba9..aaea8dd277 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -33,9 +33,16 @@ class Dispatcher rescue Object => exception ActionController::Base.process_with_exception(request, response, exception).out(output) ensure - reset_application + reset_after_dispatch end end + + def reset_application! + Controllers.clear! + Dependencies.clear + Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base) + Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base) + end private def prepare_application @@ -44,14 +51,8 @@ class Dispatcher Controllers.const_load!(:ApplicationController, "application") unless Controllers.const_defined?(:ApplicationController) end - def reset_application - if Dependencies.load? - Controllers.clear! - Dependencies.clear - Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base) - Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base) - end - + def reset_after_dispatch + reset_application! if Dependencies.load? Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) end end -- cgit v1.2.3