Skip to content

Commit

Permalink
a small change to bg task handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshardmind committed Nov 20, 2024
1 parent 2fff43d commit fd36783
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion async_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


__version__ = "7.0.2"
__version__ = "7.0.3"
3 changes: 2 additions & 1 deletion async_utils/bg_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ async def __aenter__(self: Self) -> Self:
return self

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

0 comments on commit fd36783

Please sign in to comment.