Skip to content

Commit

Permalink
Merge pull request #1055 from youknowone/cancel-timeout
Browse files Browse the repository at this point in the history
Cancel request tasks when response timeout is triggered
  • Loading branch information
r0fls committed Dec 18, 2017
2 parents 72254a7 + d54b406 commit 19466a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sanic/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def response_timeout_callback(self):
self.response_timeout_callback)
)
else:
if self._request_stream_task:
self._request_stream_task.cancel()
if self._request_handler_task:
self._request_handler_task.cancel()
try:
raise ServiceUnavailable('Response Timeout')
except ServiceUnavailable as exception:
Expand Down

0 comments on commit 19466a1

Please sign in to comment.