diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-08 05:11:16 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-08 05:11:16 +0000 |
commit | 364d2669e9f718813b0883b0d9f2428303af1dcd (patch) | |
tree | 28bdadc2699c6086cf510ba0d523c6cd0db9427a /lib/unicorn.rb | |
parent | e29ed24c56e7bc15b5f6a26cbfc40877b2fd5116 (diff) | |
download | unicorn-364d2669e9f718813b0883b0d9f2428303af1dcd.tar.gz |
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.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 8 |
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 |