Disable response timeout on websocket connections (#2081)

* Disable response timeout on websocket connections

* Add response timeout ignore test to websockets

* add logging assertion

* Move test items inside test context
This commit is contained in:
Adam Hopkins
2021-03-23 01:20:17 +02:00
committed by GitHub
parent 7be5f0ed3d
commit 4998fd54c0
2 changed files with 49 additions and 17 deletions

View File

@@ -234,11 +234,16 @@ class HttpProtocol(asyncio.Protocol):
if stage is Stage.IDLE and duration > self.keep_alive_timeout:
logger.debug("KeepAlive Timeout. Closing connection.")
elif stage is Stage.REQUEST and duration > self.request_timeout:
logger.debug("Request Timeout. Closing connection.")
self._http.exception = RequestTimeout("Request Timeout")
elif stage is Stage.HANDLER and self._http.upgrade_websocket:
logger.debug("Handling websocket. Timeouts disabled.")
return
elif (
stage in (Stage.HANDLER, Stage.RESPONSE, Stage.FAILED)
and duration > self.response_timeout
):
logger.debug("Response Timeout. Closing connection.")
self._http.exception = ServiceUnavailable("Response Timeout")
else:
interval = (