Skip to content

Commit fd36783

Browse files
committed
a small change to bg task handling
1 parent 2fff43d commit fd36783

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

async_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515

16-
__version__ = "7.0.2"
16+
__version__ = "7.0.3"

async_utils/bg_tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ async def __aenter__(self: Self) -> Self:
4444
return self
4545

4646
async def __aexit__(self, exc_type: type[Exception], exc: Exception, tb: TracebackType):
47-
if tsks := self._tasks.copy():
47+
while tsks := self._tasks.copy():
4848
_done, _pending = await asyncio.wait(tsks, timeout=self._exit_timeout)
4949
for task in _pending:
5050
task.cancel()
51+
await asyncio.sleep(0)

0 commit comments

Comments
 (0)