about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-05-28 10:45:32 -0700
committerEric Wong <normalperson@yhbt.net>2009-05-28 11:45:15 -0700
commit18c4ade90959d4eaa0048e83f3ce1052fa8a5905 (patch)
treea3678c7eabf664c764f9bccbfa71867983a21113 /lib
parent894631ab86de364fda9a12693896678f1c9795f8 (diff)
downloadunicorn-18c4ade90959d4eaa0048e83f3ce1052fa8a5905.tar.gz
This makes SIGHUP handling more consistent across different
configurations, and allows togging preload_app to take effect
when SIGHUP is issued.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index be4b6ca..044fed2 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -72,6 +72,7 @@ module Unicorn
       @listener_opts = {}
       @config.commit!(self, :skip => [:listeners, :pid])
       @request = HttpRequest.new(@logger)
+      @orig_app = app
     end
 
     # Runs the thing.  Returns self so you can run join on it
@@ -458,7 +459,7 @@ module Unicorn
       worker.tempfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
       @after_fork.call(self, worker) # can drop perms
       @timeout /= 2.0 # halve it for select()
-      build_app! unless @config[:preload_app]
+      build_app! unless @preload_app
     end
 
     def reopen_worker_logs(worker_nr)
@@ -576,6 +577,8 @@ module Unicorn
         @config.commit!(self)
         kill_each_worker(:QUIT)
         Unicorn::Util.reopen_logs
+        @app = @orig_app
+        build_app! if @preload_app
         logger.info "done reloading config_file=#{@config.config_file}"
       rescue Object => e
         logger.error "error reloading config_file=#{@config.config_file}: " \