Skip to content

Commit 60d55bc

Browse files
committed
@sanderegg review: using it in cancel_wait_task
1 parent 0a8a29e commit 60d55bc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/service-library/src/servicelib/async_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import contextlib
32
import datetime
43
import logging
54
from collections import deque
@@ -9,6 +8,8 @@
98
from functools import wraps
109
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar
1110

11+
from common_library.async_tools import cancel_and_wait
12+
1213
from . import tracing
1314
from .utils_profiling_middleware import dont_profile, is_profiling, profile_context
1415

@@ -244,8 +245,5 @@ async def cancel_wait_task(
244245
up the cancellation. If None it waits forever.
245246
:raises TimeoutError: raised if cannot cancel the task.
246247
"""
247-
248-
task.cancel()
249248
async with asyncio.timeout(max_delay):
250-
with contextlib.suppress(asyncio.CancelledError):
251-
await task
249+
await cancel_and_wait(task)

0 commit comments

Comments
 (0)