From ef3ce3c839a61acbb6ac0c138e4a90d449163cf8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 19 Aug 2009 01:12:37 -0700 Subject: rainbows: avoid object creation overhead for ticker While gettimeofday() isn't even a syscall on modern x86_64 Linux machines; Time objects aren't cheap. So avoid using time entirely as a fchmod argument and stick with 0s and 1s. --- lib/unicorn/rainbows.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/unicorn/rainbows.rb b/lib/unicorn/rainbows.rb index 0f33db7..21ec43b 100644 --- a/lib/unicorn/rainbows.rb +++ b/lib/unicorn/rainbows.rb @@ -85,11 +85,12 @@ module Unicorn end end + nr = 0 begin Actor.sleep 1 clients.delete_if { |a| a.dead? } if alive - alive.chmod(Time.now.to_i) + alive.chmod(nr = 0 == nr ? 1 : 0) ppid == Process.ppid or alive = false end end while alive || ! clients.empty? -- cgit v1.2.3-24-ge0c7