about summary refs log tree commit homepage
path: root/lib/yahns/worker.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-11-06 02:24:10 +0000
committerEric Wong <normalperson@yhbt.net>2013-11-06 02:36:27 +0000
commit4c5aefa112a42d293300ba8c1f31230b6163ca76 (patch)
tree9eaad400971c6f068c77d53ccde25ba7d0241caf /lib/yahns/worker.rb
parent0151fa2bcba2371a36d22d072ca756f2959de1e0 (diff)
downloadyahns-4c5aefa112a42d293300ba8c1f31230b6163ca76.tar.gz
Double SIGQUIT defeats the use of graceful shutdown.  We must not
watch the worker pipe again for readability after we've initiated
graceful shutdown.
Diffstat (limited to 'lib/yahns/worker.rb')
-rw-r--r--lib/yahns/worker.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/yahns/worker.rb b/lib/yahns/worker.rb
index 0d25acc..9b1bb8a 100644
--- a/lib/yahns/worker.rb
+++ b/lib/yahns/worker.rb
@@ -23,8 +23,11 @@ class Yahns::Worker # :nodoc:
   # This causes the worker to gracefully exit if the master
   # dies unexpectedly.
   def yahns_step
-    @to_io.kgio_tryread(11) == nil and Process.kill(:QUIT, $$)
-    :wait_readable
+    if @to_io.kgio_tryread(11) == nil
+      Process.kill(:QUIT, $$)
+      @to_io.close
+    end
+    :ignore
   end
 
   # worker objects may be compared to just plain Integers