From e1993001dab0a8d7fbb97252fe5a4bddca6368a8 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Thu, 9 Mar 2023 13:15:37 +0100 Subject: [PATCH] L2SS-1258: Fix cleaning up event unsubscription maintenance --- .../tangostationcontrol/devices/temperature_manager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py b/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py index c134d5150..e3567d4cc 100644 --- a/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py +++ b/tangostationcontrol/tangostationcontrol/devices/temperature_manager.py @@ -138,9 +138,13 @@ class TemperatureManager(LOFARDevice): # unsubscribe from all events for attr_name in list(self.temp_error_attrs.keys()): - dev_attr = self.temp_error_attrs[attr_name] - dev_attr.proxy.unsubscribe_event(dev_attr.subscription_id) - del self.temp_error_attrs[attr_name] + try: + dev_attr = self.temp_error_attrs[attr_name] + dev_attr.proxy.unsubscribe_event(dev_attr.subscription_id) + except Exception as e: + raise Exception(f"Failed to unsubscribe from event regarding device {dev_attr.proxy.dev_name()} attribute {attr_name}") from e + finally: + del self.temp_error_attrs[attr_name] is_alarming_R = attribute( dtype=bool, -- GitLab