add configurable backlog #263
This commit is contained in:
parent
16959caa34
commit
e7922c1b54
|
@ -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):
|
error_handler=None, logger=None, backlog=100):
|
||||||
if logger is None:
|
if logger is None:
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
|
@ -29,6 +29,7 @@ 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)
|
||||||
|
@ -278,7 +279,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': self.backlog
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user