some changes after review of @davisp

This commit is contained in:
Benoit Chesneau 2010-02-03 15:54:14 +01:00
parent fd4e13511d
commit c3801b5283
3 changed files with 5 additions and 7 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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.