Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Re: updates in git://bogomips.org/rainbows.git
Date: Fri, 20 May 2011 14:04:37 -0700	[thread overview]
Message-ID: <20110520210437.GA17040@dcvr.yhbt.net> (raw)
In-Reply-To: <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> 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


  parent reply	other threads:[~2011-05-20 21:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 19:16 updates in git://bogomips.org/rainbows.git Eric Wong
     [not found] ` <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2011-05-20 21:04   ` Eric Wong [this message]
2011-05-20 22:25   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110520210437.GA17040@dcvr.yhbt.net \
    --to=normalperson-rmlxzr9ms24@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).