From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: updates in git://bogomips.org/rainbows.git Date: Fri, 20 May 2011 14:04:37 -0700 Message-ID: <20110520210437.GA17040@dcvr.yhbt.net> References: <20110520191655.GA11860@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1305925498 30294 80.91.229.12 (20 May 2011 21:04:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 May 2011 21:04:58 +0000 (UTC) To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri May 20 23:04:54 2011 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:255 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QNWsJ-0002eB-VJ for gclrrg-rainbows-talk@m.gmane.org; Fri, 20 May 2011 23:04:48 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 7E9A31858374; Fri, 20 May 2011 17:04:46 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 1C6701858374 for ; Fri, 20 May 2011 17:04:37 -0400 (EDT) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 91BAC1F6AE; Fri, 20 May 2011 21:04:37 +0000 (UTC) Eric Wong wrote: > == dropping keepalive clients on SIGQUIT > > It would require more time/effort to get this working with EventMachine > (since we just rely on set_comm_inactivity_timeout in EventMachine). > Anybody really care about it? Actually, it's quick for EM (within 1s) and now even quicker: diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb index b136518..025b795 100644 --- a/lib/rainbows/event_machine.rb +++ b/lib/rainbows/event_machine.rb @@ -74,11 +74,11 @@ module Rainbows::EventMachine conns = EM.instance_variable_get(:@conns) or raise RuntimeError, "EM @conns instance variable not accessible!" Rainbows::EventMachine::Server.const_set(:CUR, conns) + Rainbows.at_quit do + EM.next_tick { conns.each_value { |c| client_class === c and c.quit } } + end EM.add_periodic_timer(1) do - unless Rainbows.tick - conns.each_value { |c| client_class === c and c.quit } - EM.stop if conns.empty? && EM.reactor_running? - end + EM.stop if ! Rainbows.tick && conns.empty? && EM.reactor_running? end LISTENERS.map! do |s| EM.watch(s, Rainbows::EventMachine::Server) do |c| --- Longer term, I'd like to lower the tick frequency to save power, but it's not going to be useful for MRI 1.9.x as long as the timer thread is waking up every 10ms (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/33456) -- Eric Wong _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying