mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
some changes after review of @davisp
This commit is contained in:
parent
fd4e13511d
commit
c3801b5283
@ -157,6 +157,7 @@ class Arbiter(object):
|
|||||||
self.log.info("Listen on %s:%s" % self.LISTENER.getsockname())
|
self.log.info("Listen on %s:%s" % self.LISTENER.getsockname())
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.log.info("Listen on %s" % self.LISTENER.getsockname())
|
self.log.info("Listen on %s" % self.LISTENER.getsockname())
|
||||||
|
|
||||||
def init_socket_fromfd(self, fd, address):
|
def init_socket_fromfd(self, fd, address):
|
||||||
if isinstance(address, basestring):
|
if isinstance(address, basestring):
|
||||||
sock = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM)
|
sock = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import sys
|
|||||||
from gunicorn.arbiter import Arbiter
|
from gunicorn.arbiter import Arbiter
|
||||||
from gunicorn import util
|
from gunicorn import util
|
||||||
|
|
||||||
__usage__ = "%prog [OPTIONS]"
|
__usage__ = "%prog [OPTIONS] [APP_MODULE]"
|
||||||
|
|
||||||
LOG_LEVELS = {
|
LOG_LEVELS = {
|
||||||
"critical": logging.CRITICAL,
|
"critical": logging.CRITICAL,
|
||||||
@ -113,8 +113,7 @@ def main(usage, get_app):
|
|||||||
pidfile=opts.pidfile
|
pidfile=opts.pidfile
|
||||||
)
|
)
|
||||||
|
|
||||||
arbiter = Arbiter(addr, workers, app,
|
arbiter = Arbiter(addr, workers, app, **kwargs)
|
||||||
**kwargs)
|
|
||||||
if opts.daemon:
|
if opts.daemon:
|
||||||
daemonize()
|
daemonize()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -27,8 +27,7 @@ class Worker(object):
|
|||||||
|
|
||||||
PIPE = []
|
PIPE = []
|
||||||
|
|
||||||
def __init__(self, workerid, ppid, socket, app, timeout,
|
def __init__(self, workerid, ppid, socket, app, timeout, debug=False):
|
||||||
debug=False):
|
|
||||||
self.nr = 0
|
self.nr = 0
|
||||||
self.id = workerid
|
self.id = workerid
|
||||||
self.ppid = ppid
|
self.ppid = ppid
|
||||||
@ -108,12 +107,11 @@ class Worker(object):
|
|||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
if e[0] not in (errno.EAGAIN, errno.ECONNABORTED):
|
||||||
raise
|
raise
|
||||||
if self.nr < 0: break
|
|
||||||
|
|
||||||
# Keep processing clients until no one is waiting.
|
# Keep processing clients until no one is waiting.
|
||||||
# This prevents the need to select() for every
|
# This prevents the need to select() for every
|
||||||
# client that we process.
|
# client that we process.
|
||||||
if self.nr != 0:
|
if self.nr > 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If our parent changed then we shut down.
|
# If our parent changed then we shut down.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user