Skip to content

Commit

Permalink
Fix memory leak from Cancellable helper
Browse files Browse the repository at this point in the history
  • Loading branch information
isra17 committed Jul 26, 2023
1 parent 7ec1ede commit 7d87f07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/saturn_engine/utils/asyncutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,7 @@ async def __call__(self, *args: t.Any, **kwargs: t.Any) -> R:
self.func(*args, **kwargs), name=f"cancellable({self.func})"
)
self._tasks.add(task)
return await task
try:
return await task
finally:
self._tasks.remove(task)

0 comments on commit 7d87f07

Please sign in to comment.