From c3801b528370832f581391b6a4077c6856727a17 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Wed, 3 Feb 2010 15:54:14 +0100 Subject: [PATCH] some changes after review of @davisp --- gunicorn/arbiter.py | 1 + gunicorn/main.py | 5 ++--- gunicorn/worker.py | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 3e5c1938..ef65ff37 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -157,6 +157,7 @@ class Arbiter(object): self.log.info("Listen on %s:%s" % self.LISTENER.getsockname()) except TypeError: self.log.info("Listen on %s" % self.LISTENER.getsockname()) + def init_socket_fromfd(self, fd, address): if isinstance(address, basestring): sock = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM) diff --git a/gunicorn/main.py b/gunicorn/main.py index 922e6b56..1e394a41 100644 --- a/gunicorn/main.py +++ b/gunicorn/main.py @@ -14,7 +14,7 @@ import sys from gunicorn.arbiter import Arbiter from gunicorn import util -__usage__ = "%prog [OPTIONS]" +__usage__ = "%prog [OPTIONS] [APP_MODULE]" LOG_LEVELS = { "critical": logging.CRITICAL, @@ -113,8 +113,7 @@ def main(usage, get_app): pidfile=opts.pidfile ) - arbiter = Arbiter(addr, workers, app, - **kwargs) + arbiter = Arbiter(addr, workers, app, **kwargs) if opts.daemon: daemonize() else: diff --git a/gunicorn/worker.py b/gunicorn/worker.py index 28b39999..07fcbe6b 100644 --- a/gunicorn/worker.py +++ b/gunicorn/worker.py @@ -27,8 +27,7 @@ class Worker(object): PIPE = [] - def __init__(self, workerid, ppid, socket, app, timeout, - debug=False): + def __init__(self, workerid, ppid, socket, app, timeout, debug=False): self.nr = 0 self.id = workerid self.ppid = ppid @@ -108,12 +107,11 @@ class Worker(object): except socket.error, e: if e[0] not in (errno.EAGAIN, errno.ECONNABORTED): raise - if self.nr < 0: break # Keep processing clients until no one is waiting. # This prevents the need to select() for every # client that we process. - if self.nr != 0: + if self.nr > 0: continue # If our parent changed then we shut down.