shield some finally ops

This commit is contained in:
Maxim Devaev
2022-08-05 15:07:17 +03:00
parent 9ee63aba3e
commit eeaeebf7c7
2 changed files with 34 additions and 8 deletions

View File

@@ -249,8 +249,14 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
yield self.__device_writer
await self.__write_image_info(True)
finally:
await self.__close_device_writer()
await self.__load_device_info()
try:
await asyncio.shield(self.__close_device_writer())
except asyncio.CancelledError:
pass
try:
await asyncio.shield(self.__load_device_info())
except asyncio.CancelledError:
pass
@aiotools.atomic
async def remove(self, name: str) -> None: