From fa7a282502c253ad3203f28bb10eede8b3a3cd3e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Feb 2011 09:06:37 +0000 Subject: less expensive QUIT processing Avoid constantly nuking the method cache and raising repeated exceptions while our master process is shutting us down. --- lib/rainbows.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/rainbows.rb b/lib/rainbows.rb index fed0715..480f2d6 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -98,10 +98,12 @@ module Rainbows end def self.quit! - @alive = false - Rainbows::HttpParser.quit - @expire ||= Time.now + (@server.timeout * 2.0) - @server.class.const_get(:LISTENERS).map! { |s| s.close rescue nil }.clear + unless @expire + @alive = false + Rainbows::HttpParser.quit + @expire = Time.now + (@server.timeout * 2.0) + @server.class.const_get(:LISTENERS).map! { |s| s.close rescue nil }.clear + end false end -- cgit v1.2.3-24-ge0c7