From 54deb6a9a0e868c0958c9ec145e311661ce90e54 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 9 Jun 2011 00:23:28 +0000 Subject: move reopen_worker_logs to base We may not always use Rainbows! :Base since we don't want keepalive/immediate log reopening in some cases. --- lib/rainbows/base.rb | 7 +++++++ lib/rainbows/http_server.rb | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb index e0c99e9..41daa2d 100644 --- a/lib/rainbows/base.rb +++ b/lib/rainbows/base.rb @@ -36,5 +36,12 @@ module Rainbows::Base klass.const_set :LISTENERS, Rainbows::HttpServer::LISTENERS end + def reopen_worker_logs(worker_nr) + logger.info "worker=#{worker_nr} reopening logs..." + Unicorn::Util.reopen_logs + logger.info "worker=#{worker_nr} done reopening logs" + rescue + Rainbows.quit! # let the master reopen and refork us + end # :startdoc: end diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index cbeb38f..be02630 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -21,14 +21,6 @@ class Rainbows::HttpServer < Unicorn::HttpServer @worker_connections ||= @use == :Base ? 1 : 50 end - def reopen_worker_logs(worker_nr) - logger.info "worker=#{worker_nr} reopening logs..." - Unicorn::Util.reopen_logs - logger.info "worker=#{worker_nr} done reopening logs" - rescue - Rainbows.quit! # let the master reopen and refork us - end - # Add one second to the timeout since our fchmod heartbeat is less # precise (and must be more conservative) than Unicorn does. We # handle many clients per process and can't chmod on every -- cgit v1.2.3-24-ge0c7