Convert server lambda to partial

Partials are faster then lambdas for repeated calls.
This commit is contained in:
John Piasetzki 2016-11-25 14:53:18 -05:00
parent fc19f2ea34
commit 13808bf282

View File

@ -235,14 +235,23 @@ def serve(host, port, request_handler, before_start=None, after_start=None,
connections = {} connections = {}
signal = Signal() signal = Signal()
server_coroutine = loop.create_server(lambda: HttpProtocol( server = partial(
HttpProtocol,
loop=loop, loop=loop,
connections=connections, connections=connections,
signal=signal, signal=signal,
request_handler=request_handler, request_handler=request_handler,
request_timeout=request_timeout, request_timeout=request_timeout,
request_max_size=request_max_size, request_max_size=request_max_size,
), host, port, reuse_port=reuse_port, sock=sock) )
server_coroutine = loop.create_server(
server,
host,
port,
reuse_port=reuse_port,
sock=sock
)
# Instead of pulling time at the end of every request, # Instead of pulling time at the end of every request,
# pull it once per minute # pull it once per minute