From caa5740b971111a487d5ed4f2b605a9e8220d47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Wed, 25 Dec 2024 13:27:40 -0800 Subject: [PATCH] Make sure notification failure don't prevent the dome from closing --- python/lvmecp/actor/actor.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/lvmecp/actor/actor.py b/python/lvmecp/actor/actor.py index efbd4c3..04fb388 100644 --- a/python/lvmecp/actor/actor.py +++ b/python/lvmecp/actor/actor.py @@ -120,12 +120,14 @@ async def monitor_dome(self, delay: float = 30.0): if self._engineering_mode: pass elif self.plc.dome.is_daytime() and not is_closing: - self.write("w", text="Dome found open during daytime. Closing.") - await send_notification( - "Dome found open during daytime. Closing.", - level="warning", - ) - await self.plc.dome.close() + try: + self.write("w", text="Dome found open during daytime. Closing.") + await send_notification( + "Dome found open during daytime. Closing.", + level="warning", + ) + finally: + await self.plc.dome.close() async def engineering_mode( self,