SIENTIAPDE-1312

Fix pod URI formatting and enhance disconnection error logging in OpcManager

- Updated pod URI construction to replace hyphens with colons for correct formatting.
- Improved error logging during disconnection attempts to include the attempt number for better traceability.
- Changed disconnection_fallback method call to be awaited for proper asynchronous handling.
This commit is contained in:
vitor-aignosi
2025-10-20 15:56:00 -03:00
parent 7001b5e9bd
commit 8c552f50a8

View File

@@ -197,7 +197,7 @@ class OpcManager(BaseActivity):
self.client.name = self.pod_id self.client.name = self.pod_id
self.client.application_name = self.pod_id self.client.application_name = self.pod_id
pod_uri = f'urn:sientia-do:pod:{self.pod_id}' pod_uri = self.pod_id.replace('-', ':')
self.client.application_uri = pod_uri self.client.application_uri = pod_uri
self.client.product_uri = pod_uri self.client.product_uri = pod_uri
@@ -347,7 +347,7 @@ class OpcManager(BaseActivity):
await self.client.disconnect() await self.client.disconnect()
return [] return []
except Exception as e: except Exception as e:
self.logger.error(f'Failed to disconnect from OPC UA server: {e}') self.logger.error(f'Failed to disconnect from OPC UA serve in attempt {i+1} of 5: {e}')
error_stack.append({ error_stack.append({
'attempt': i+1, 'attempt': i+1,
'error': str(e), 'error': str(e),
@@ -387,7 +387,7 @@ class OpcManager(BaseActivity):
self.logger.error(f'Failed to clean up subscription: {sub_error}') self.logger.error(f'Failed to clean up subscription: {sub_error}')
errors = self.disconnection_fallback() errors = await self.disconnection_fallback()
if errors: if errors:
self.send_notification( self.send_notification(