Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add msg in task.cancel #2416

Merged
merged 10 commits into from Jun 16, 2022
7 changes: 6 additions & 1 deletion sanic/server/protocols/http_protocol.py
Expand Up @@ -8,6 +8,8 @@
if TYPE_CHECKING: # no cov
from sanic.app import Sanic

import sys

from asyncio import CancelledError
from time import monotonic as current_time

Expand Down Expand Up @@ -169,7 +171,10 @@ def check_timeouts(self):
)
self.loop.call_later(max(0.1, interval), self.check_timeouts)
return
self._task.cancel()
cancel_msg_args = ()
if sys.version_info >= (3, 9):
cancel_msg_args = ("Cancel connection task with a timeout",)
self._task.cancel(*cancel_msg_args)
except Exception:
error_logger.exception("protocol.check_timeouts")

Expand Down