Remove HTTP timeout by default, and mid-response error for it

This commit is contained in:
Andrew Godwin 2018-05-30 09:52:47 -07:00 committed by Andrew Godwin
parent 84466d4ae4
commit 8c031239ad
3 changed files with 8 additions and 4 deletions

View File

@ -86,7 +86,7 @@ class CommandLineInterface(object):
"--http-timeout", "--http-timeout",
type=int, type=int,
help="How long to wait for worker before timing out HTTP connections", help="How long to wait for worker before timing out HTTP connections",
default=120, default=None,
) )
self.parser.add_argument( self.parser.add_argument(
"--access-log", "--access-log",

View File

@ -256,8 +256,12 @@ class WebRequest(http.Request):
Called periodically to see if we should timeout something Called periodically to see if we should timeout something
""" """
# Web timeout checking # Web timeout checking
if self.duration() > self.server.http_timeout: if self.server.http_timeout and self.duration() > self.server.http_timeout:
self.basic_error(503, b"Service Unavailable", "Application failed to respond within time limit.") if self._response_started:
logger.warning("Application timed out while sending response")
self.finish()
else:
self.basic_error(503, b"Service Unavailable", "Application failed to respond within time limit.")
### Utility functions ### Utility functions

View File

@ -42,7 +42,7 @@ class Server(object):
endpoints=None, endpoints=None,
signal_handlers=True, signal_handlers=True,
action_logger=None, action_logger=None,
http_timeout=120, http_timeout=None,
websocket_timeout=86400, websocket_timeout=86400,
websocket_connect_timeout=20, websocket_connect_timeout=20,
ping_interval=20, ping_interval=20,