SIENTIAPDE-1049Enhance OPC connection handling with error logging and update branch in values.yaml

This commit is contained in:
vitor-aignosi
2025-05-19 17:06:29 -03:00
parent c13d7cf391
commit 9196861033
3 changed files with 28 additions and 11 deletions

View File

@@ -190,11 +190,18 @@ class OpcManager():
try:
[self.subscriptions[sub].delete() for sub in self.subscriptions]
self.logger.warning("Deleted all subscriptions.")
except Exception as sub_error:
self.logger.error(f"Failed to clean up subscription: {sub_error}")
try:
self.client.disconnect()
except Exception as conn_error:
self.logger.error(
f"Failed to disconnect from OPC UA server: {conn_error}")
finally:
del self.client
self.client = None
self.logger.warning("Disconnected from OPC UA server.")
except Exception as sub_error:
self.logger.error(f"Failed to clean up subscription: {sub_error}")
def datachange_notification(self, node, _val, data):
"""