Skip to content

Commit

Permalink
Await cancelled task (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Nov 17, 2023
1 parent 508799b commit 23948e3
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 23948e3

Please sign in to comment.