about summary refs log tree commit homepage
path: root/lib/rainbows/base.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-09 00:23:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-09 00:23:28 +0000
commit54deb6a9a0e868c0958c9ec145e311661ce90e54 (patch)
tree16a05d18609a2ce09a60491117ee1f490e93c9b7 /lib/rainbows/base.rb
parent99244e8e30eded813bd8eaf7f2136a3871bd486c (diff)
downloadrainbows-54deb6a9a0e868c0958c9ec145e311661ce90e54.tar.gz
We may not always use Rainbows! :Base since we don't want
keepalive/immediate log reopening in some cases.
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r--lib/rainbows/base.rb7
1 files changed, 7 insertions, 0 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