Skip to content

Commit

Permalink
Await cancelled task
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Nov 17, 2023
1 parent 508799b commit a0ae964
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aiohttp_devtools/runserver/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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
Expand Down Expand Up @@ -36,9 +37,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 a0ae964

Please sign in to comment.