Skip to content

Commit 473bfa0

Browse files
committed
Update _is_daemon.py
1 parent 58e5f40 commit 473bfa0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

yaqd-core/yaqd_core/_is_daemon.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(
8787
self._busy_sig = asyncio.Event()
8888
self._not_busy_sig = asyncio.Event()
8989

90-
self._loop = asyncio.get_event_loop()
90+
self._loop = asyncio.get_running_loop()
9191

9292
try:
9393
self._state_filepath.parent.mkdir(parents=True, exist_ok=True)
@@ -298,6 +298,9 @@ async def shutdown_all(cls, sig, loop):
298298
# are not themselves cancelled.
299299
[d.close() for d in cls._daemons]
300300
tasks = [t for t in asyncio.all_tasks() if t is not asyncio.current_task()]
301+
for task in tasks:
302+
if "process" in task.get_coro().__repr__():
303+
tasks.pop(tasks.index(task))
301304
await asyncio.gather(*tasks, return_exceptions=True)
302305
[d._save_state() for d in cls._daemons]
303306
if hasattr(signal, "SIGHUP") and sig == signal.SIGHUP:

0 commit comments

Comments
 (0)