From 6858c79a49a5d25edb6c06ffd131749eb2f23b2b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Jun 2011 02:21:58 +0000 Subject: Unicorn 4.x resync for ticker This removes the extra per-process file descriptor and replaces it with Raindrops. --- lib/rainbows.rb | 5 ++--- lib/rainbows/base.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 64d2d03..ef9e75f 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -65,7 +65,7 @@ module Rainbows attr_accessor :server attr_accessor :cur # may not always be used attr_reader :alive - attr_writer :tick_io + attr_writer :worker attr_writer :forked end @@ -78,7 +78,6 @@ module Rainbows @alive = true @cur = 0 - @tick_mod = 0 @expire = nil @at_quit = [] @@ -87,7 +86,7 @@ module Rainbows end def self.tick - @tick_io.chmod(@tick_mod = 0 == @tick_mod ? 1 : 0) + @worker.tick = Time.now.to_i exit!(2) if @expire && Time.now >= @expire @alive && @server.master_pid == Process.ppid or quit! end diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb index c2f7335..e614ccf 100644 --- a/lib/rainbows/base.rb +++ b/lib/rainbows/base.rb @@ -13,7 +13,7 @@ module Rainbows::Base super(worker) Rainbows::Response.setup(self.class) Rainbows::MaxBody.setup - Rainbows.tick_io = worker.tmp + Rainbows.worker = worker # we're don't use the self-pipe mechanism in the Rainbows! worker # since we don't defer reopening logs -- cgit v1.2.3-24-ge0c7