about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-05-02 23:44:52 -0700
committerEric Wong <normalperson@yhbt.net>2009-05-02 23:50:34 -0700
commitbe1542f47f0ea4cfb93a7b8dd5e94627f4a8b51f (patch)
treeabd75bc652776ad47da4f8473f7f92aa6b7473ac
parent83ab6d80792e5abc37c59a56a31be9433ecdd911 (diff)
downloadunicorn-be1542f47f0ea4cfb93a7b8dd5e94627f4a8b51f.tar.gz
Only do speculative accept on the previous ready set of
listeners.  This makes it less CPU-intensive to have per-process
debug listeners configured.

Unfortunately, this makes non-primary listeners unable to accept
connections if the server is under extremely heavy load and
speculative accept() on the previous listener is always
succeeding and hogging the process.  Fortunately, this is an
uncommon case.
-rw-r--r--lib/unicorn.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 05866df..71d2c45 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -517,9 +517,7 @@ module Unicorn
           # we're probably reasonably busy, so avoid calling select()
           # and do a speculative accept_nonblock on every listener
           # before we sleep again in select().
-          if nr != 0 # (nr < 0) => reopen logs
-            ready = LISTENERS
-          else
+          if nr == 0 # (nr < 0) => reopen logs
             master_pid == Process.ppid or exit(0)
             alive.chmod(nr += 1)
             begin