about summary refs log tree commit homepage
path: root/lib/rainbows/revactor.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-06 19:45:17 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-06 19:45:17 -0800
commit1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7 (patch)
tree0c95f2d8fc4de8542f7716832800614e1e7a8872 /lib/rainbows/revactor.rb
parente1dcadef6ca242e36e99aab19e3e040bf01070f9 (diff)
downloadrainbows-1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7.tar.gz
It turns out neither the EventMachine and Rev classes
checked for master death in its heartbeat mechanism.
Since we managed to forget the same thing twice, we
now have a test case for it and also centralized the
code to remove duplication.
Diffstat (limited to 'lib/rainbows/revactor.rb')
-rw-r--r--lib/rainbows/revactor.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index ddcbc04..003b704 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -101,20 +101,14 @@ module Rainbows
         end
       end
 
-      m = 0
-      check_quit = lambda do
-        worker.tmp.chmod(m = 0 == m ? 1 : 0)
-        G.alive = false if master_pid != Process.ppid
-      end
-
       begin
         Actor.receive do |filter|
-          filter.after(1, &check_quit)
+          filter.after(1) { G.tick }
           filter.when(Case[:exit, Actor, Object]) do |_,actor,_|
             orig = clients.size
             clients.delete(actor.object_id)
             orig >= limit and listeners.each { |l| l << :resume }
-            check_quit.call
+            G.tick
           end
         end
       end while G.alive || clients.size > 0