using shield_fg()

This commit is contained in:
Maxim Devaev
2022-08-07 19:18:23 +03:00
parent 1d4b39ef1b
commit fdc3edfa79
7 changed files with 16 additions and 30 deletions

View File

@@ -101,7 +101,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
try:
await aiotools.wait_first(*tasks)
finally:
await asyncio.shield(self.__cleanup(tasks))
await aiotools.shield_fg(self.__cleanup(tasks))
async def __cleanup(self, tasks: List[asyncio.Task]) -> None:
for task in tasks:

View File

@@ -147,7 +147,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
fb_sender=self.__fb_sender_task_loop(),
)
finally:
await asyncio.shield(self.__cleanup())
await aiotools.shield_fg(self.__cleanup())
async def __cleanup(self) -> None:
if self.__kvmd_session:
@@ -498,7 +498,7 @@ class VncServer: # pylint: disable=too-many-instance-attributes
except Exception:
logger.exception("%s [entry]: Unhandled exception in client task", remote)
finally:
await asyncio.shield(cleanup_client(writer))
await aiotools.shield_fg(cleanup_client(writer))
self.__handle_client = handle_client