Skip to content

Commit

Permalink
bug: only call shutdown finalizer if loop is running
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Jan 24, 2024
1 parent 8915acc commit 3577322
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def _get_async_loop(cls):

def __del__(self):
try:
asyncio.run(self.shutdown())
if self._loop.is_running():
self._loop.run_until_complete(self.shutdown())
except Exception as e:
pass

Expand Down

0 comments on commit 3577322

Please sign in to comment.