move backlog to run()

This commit is contained in:
Raphael Deem 2017-01-04 09:31:06 -08:00
parent e7922c1b54
commit 616e20d467

View File

@ -20,7 +20,7 @@ from .exceptions import ServerError
class Sanic: class Sanic:
def __init__(self, name=None, router=None, def __init__(self, name=None, router=None,
error_handler=None, logger=None, backlog=100): error_handler=None, logger=None):
if logger is None: if logger is None:
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,
@ -29,7 +29,6 @@ class Sanic:
if name is None: if name is None:
frame_records = stack()[1] frame_records = stack()[1]
name = getmodulename(frame_records[1]) name = getmodulename(frame_records[1])
self.backlog = backlog
self.name = name self.name = name
self.router = router or Router() self.router = router or Router()
self.error_handler = error_handler or Handler(self) self.error_handler = error_handler or Handler(self)
@ -243,7 +242,7 @@ class Sanic:
def run(self, host="127.0.0.1", port=8000, debug=False, before_start=None, def run(self, host="127.0.0.1", port=8000, debug=False, before_start=None,
after_start=None, before_stop=None, after_stop=None, sock=None, after_start=None, before_stop=None, after_stop=None, sock=None,
workers=1, loop=None, protocol=HttpProtocol): workers=1, loop=None, protocol=HttpProtocol, backlog=100):
""" """
Runs the HTTP Server and listens until keyboard interrupt or term Runs the HTTP Server and listens until keyboard interrupt or term
signal. On termination, drains connections before closing. signal. On termination, drains connections before closing.
@ -280,7 +279,7 @@ class Sanic:
'request_timeout': self.config.REQUEST_TIMEOUT, 'request_timeout': self.config.REQUEST_TIMEOUT,
'request_max_size': self.config.REQUEST_MAX_SIZE, 'request_max_size': self.config.REQUEST_MAX_SIZE,
'loop': loop, 'loop': loop,
'backlog': self.backlog 'backlog': backlog
} }
# -------------------------------------------- # # -------------------------------------------- #