summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-08 05:11:16 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-08 05:11:16 +0000
commit364d2669e9f718813b0883b0d9f2428303af1dcd (patch)
tree28bdadc2699c6086cf510ba0d523c6cd0db9427a
parente29ed24c56e7bc15b5f6a26cbfc40877b2fd5116 (diff)
No need for extra checks when we're just doing read_nonblock.
We'll also avoid reallocating a 16K buffer every time we sleep,
we can just reuse the buffer the workers normally use to process
request.
-rw-r--r--lib/unicorn.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index a363014..b34e11a 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -483,11 +483,11 @@ module Unicorn
     # Wake up every second anyways to run murder_lazy_workers
     def master_sleep(sec)
       begin
-        ready = IO.select([SELF_PIPE.first], nil, nil, sec) or return
-        ready.first && ready.first.first or return
-        loop { SELF_PIPE.first.read_nonblock(Const::CHUNK_SIZE) }
+        IO.select([ SELF_PIPE.first ], nil, nil, sec) or return
+        SELF_PIPE.first.read_nonblock(Const::CHUNK_SIZE, HttpRequest::BUF)
       rescue Errno::EAGAIN, Errno::EINTR
-      end
+        break
+      end while true
     end
 
     def awaken_master