timeout and backlog can now be configured in config file. we should put

more options. Also the default of backlog could be 1024 instead of 2048.
This commit is contained in:
benoitc 2010-03-03 16:03:23 +01:00
parent e5e6b70895
commit 68d1542c20
3 changed files with 11 additions and 9 deletions

View File

@ -49,13 +49,13 @@ class Arbiter(object):
self.num_workers = num_workers
self.worker_age = 0
self.app = app
self.timeout = 30
self.conf = kwargs.get("config", {})
self.timeout = self.conf['timeout']
self.reexec_pid = 0
self.debug = kwargs.get("debug", False)
self.log = logging.getLogger(__name__)
self.opts = kwargs
self.conf = kwargs.get("config", {})
self._pidfile = None
self.master_name = "Master"
self.proc_name = self.conf['proc_name']

View File

@ -13,19 +13,21 @@ from gunicorn import util
class Config(object):
DEFAULTS = dict(
proc_name = None,
default_proc_name = os.getcwd(),
backlog=2048,
bind='127.0.0.1:8000',
daemon=False,
debug=False,
default_proc_name = os.getcwd(),
group=None,
logfile='-',
loglevel='info',
pidfile=None,
workers=1,
proc_name = None,
timeout=30,
tmp_upload_dir=None,
umask="0",
user=None,
group=None,
tmp_upload_dir=None,
workers=1,
after_fork=lambda server, worker: server.log.info(
"Worker spawned (pid: %s)" % worker.pid),

View File

@ -36,7 +36,7 @@ class BaseSocket(object):
if not bound:
self.bind(sock)
sock.setblocking(0)
sock.listen(2048)
sock.listen(self.conf['backlog'])
return sock
def bind(self, sock):