Skip to content

Commit 5bb4477

Browse files
authored
Fix: unclosed event loop (#176)
1 parent a6589a4 commit 5bb4477

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aidb/utils/asyncio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ def asyncio_run(future, as_task=True):
88
loop = asyncio.get_running_loop()
99
except RuntimeError: # no event loop running
1010
loop = asyncio.new_event_loop()
11-
return loop.run_until_complete(_to_task(future, as_task, loop))
11+
ret = loop.run_until_complete(_to_task(future, as_task, loop))
12+
loop.close()
13+
return ret
1214
else:
1315
nest_asyncio.apply(loop)
1416
return asyncio.run(_to_task(future, as_task, loop))

0 commit comments

Comments
 (0)