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

Await cancelled task #622

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aiohttp_devtools/runserver/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import os
import signal
import sys
from contextlib import suppress
from multiprocessing import Process
from pathlib import Path
from typing import AsyncIterator, Iterable, Optional, Tuple, Union
from contextlib import suppress

from aiohttp import ClientSession, web
from aiohttp.client_exceptions import ClientError, ClientConnectionError
Expand Down Expand Up @@ -36,9 +36,9 @@ async def _run(self) -> None:
async def close(self, *args: object) -> None:
if self._task:
self.stopper.set()
if self._task.done():
self._task.result()
self._task.cancel()
with suppress(asyncio.CancelledError):
await self._task

async def cleanup_ctx(self, app: web.Application) -> AsyncIterator[None]:
await self.start(app)
Expand Down