diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-28 10:45:32 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-28 11:45:15 -0700 |
commit | 18c4ade90959d4eaa0048e83f3ce1052fa8a5905 (patch) | |
tree | a3678c7eabf664c764f9bccbfa71867983a21113 | |
parent | 894631ab86de364fda9a12693896678f1c9795f8 (diff) | |
download | unicorn-18c4ade90959d4eaa0048e83f3ce1052fa8a5905.tar.gz |
This makes SIGHUP handling more consistent across different configurations, and allows togging preload_app to take effect when SIGHUP is issued.
-rw-r--r-- | SIGNALS | 4 | ||||
-rw-r--r-- | lib/unicorn.rb | 5 |
2 files changed, 5 insertions, 4 deletions
@@ -6,9 +6,7 @@ processes are documented here as well. === Master Process -* HUP - reload config file and gracefully restart all workers - If "preload_app" is false (the default), the application code - will be reloaded when workers are restarted as well. +* HUP - reload config file, app, and gracefully restart all workers * INT/TERM - quick shutdown, kills all workers immediately 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}: " \ |