From 18c4ade90959d4eaa0048e83f3ce1052fa8a5905 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 28 May 2009 10:45:32 -0700 Subject: SIGHUP reloads app even if preload_app is true This makes SIGHUP handling more consistent across different configurations, and allows togging preload_app to take effect when SIGHUP is issued. --- lib/unicorn.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/unicorn.rb') 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}: " \ -- cgit v1.2.3-24-ge0c7