Merge pull request #269 from r0fls/263

add configurable backlog
This commit is contained in:
Eli Uriegas 2017-01-04 20:37:19 -06:00 committed by GitHub
commit 802e7d4654
2 changed files with 6 additions and 4 deletions

View File

@ -242,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.
@ -278,7 +278,8 @@ class Sanic:
'error_handler': self.error_handler, 'error_handler': self.error_handler,
'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': backlog
} }
# -------------------------------------------- # # -------------------------------------------- #

View File

@ -226,7 +226,7 @@ def trigger_events(events, loop):
def serve(host, port, request_handler, error_handler, before_start=None, def serve(host, port, request_handler, error_handler, before_start=None,
after_start=None, before_stop=None, after_stop=None, debug=False, after_start=None, before_stop=None, after_stop=None, debug=False,
request_timeout=60, sock=None, request_max_size=None, request_timeout=60, sock=None, request_max_size=None,
reuse_port=False, loop=None, protocol=HttpProtocol): reuse_port=False, loop=None, protocol=HttpProtocol, backlog=100):
""" """
Starts asynchronous HTTP Server on an individual process. Starts asynchronous HTTP Server on an individual process.
:param host: Address to host on :param host: Address to host on
@ -276,7 +276,8 @@ def serve(host, port, request_handler, error_handler, before_start=None,
host, host,
port, port,
reuse_port=reuse_port, reuse_port=reuse_port,
sock=sock sock=sock,
backlog=backlog
) )
# Instead of pulling time at the end of every request, # Instead of pulling time at the end of every request,